Files
30-seconds-of-code/node_modules/underscore.string/count.js
2019-08-20 15:52:05 +02:00

11 lines
250 B
JavaScript

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;
};