A simple implementation of the Boyer-Moore string search algorithm for use with node.js' Buffer objects.
I needed this functionality in one of my projects. I started to write a search algorithm right away, until (after a few lines) I realized that it's absolutely unneccessary to do so - because others must have done this before (this "reinventing the wheel" thing, you know).
So I DuckDuckGoed (they really need a new name for that search engine, by the way) around the interwebs to find a suitable approach to my problem.
I immediately stumbled over the Boyer-Moore string search algorithm. Since I didn't know anything about how effective string search is done (shame on me), I just started to write a ripoff from the Java example given in the Wikipedia article to get started learning about it.
That's why.
var moore = require( './moore' );
var index = moore.indexOf(
// the needle
new Buffer( 'find me' ),
// the haystack
new Buffer( 'Some garbage text and the `find me` sequence.' )
);