Subtheme of barrio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
399 B

2 years ago
"use strict";
var ensureString = require("../../object/validate-stringifiable-value");
module.exports = function (search) {
var string = ensureString(this), count = 0, index = 0;
search = ensureString(search);
if (!search) throw new TypeError("Search string cannot be empty");
while ((index = string.indexOf(search, index)) !== -1) {
++count;
index += search.length;
}
return count;
};