UNPKG

@chezearth/string

Version:

This is a temporary package until I can open a pull request on the original. string contains methods that aren't included in the vanilla JavaScript string such as escaping html, decoding html entities, stripping tags, etc.

13 lines (10 loc) 202 B
function count(self, substr) { var count = 0 var pos = self.indexOf(substr) while (pos >= 0) { count += 1 pos = self.indexOf(substr, pos + 1) } return count } module.exports = count