Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/fourtyone11/origin-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'assets/node_modules/ccount/index.js')
-rw-r--r--assets/node_modules/ccount/index.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/assets/node_modules/ccount/index.js b/assets/node_modules/ccount/index.js
new file mode 100644
index 0000000..3051998
--- /dev/null
+++ b/assets/node_modules/ccount/index.js
@@ -0,0 +1,22 @@
+'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
+}