occurrences

Count the occurrences of a substring within a string and keep track of each occurrence's position.

Occurrences

Count the occurrences of a substring within a string.

$ npm install occurrences
var occurrences = require('occurrences');
 
occurrences('foobar', 'o', function(count) {
  console.log(count);
});
$ cd example
$ node demo.js
$ npm install
$ make test