Sha256: bc1fdf7b7896107dcd0cdb226c70fe056c5a863c927b2debdeaf294da97b5571
Contents?: true
Size: 381 Bytes
Versions: 23
Compression:
Stored size: 381 Bytes
Contents
'use strict' module.exports = ccount function ccount(value, character) { var val = String(value) var count = 0 var index if (typeof character !== 'string' || character.length !== 1) { throw new Error('Expected character') } index = val.indexOf(character) while (index !== -1) { count++ index = val.indexOf(character, index + 1) } return count }
Version data entries
23 entries across 23 versions & 1 rubygems