Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / ccount / index.js
1 'use strict'
2
3 module.exports = ccount
4
5 function ccount(value, character) {
6   var val = String(value)
7   var count = 0
8   var index
9
10   if (typeof character !== 'string' || character.length !== 1) {
11     throw new Error('Expected character')
12   }
13
14   index = val.indexOf(character)
15
16   while (index !== -1) {
17     count++
18     index = val.indexOf(character, index + 1)
19   }
20
21   return count
22 }