_count.js 202 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 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