Version 1
[yaffs-website] / node_modules / underscore.string / count.js
diff --git a/node_modules/underscore.string/count.js b/node_modules/underscore.string/count.js
new file mode 100644 (file)
index 0000000..2207d70
--- /dev/null
@@ -0,0 +1,10 @@
+var makeString = require('./helper/makeString');
+
+module.exports = function(str, substr) {
+  str = makeString(str);
+  substr = makeString(substr);
+
+  if (str.length === 0 || substr.length === 0) return 0;
+  
+  return str.split(substr).length - 1;
+};