epeli/underscore.string — pull request #211 by gregmac (2013-06-27 03:07:01+00:00)
Title: Added multi-term search function, with tests

Multi-term (AND) search of one or more source strings.

I'm using it in a single-page app to allow the user to filter a number of objects (representing websites) by the text they enter, searching in multiple properties of the objects (URL and site name). This allows the user to enter, for example, "test1 widget" and find the object {url:'test1.w-co.net',name:'Widget Inc - Test Site 1'}.

eg: Successful searches:

```
_.search('foo bar','match foo this bar')
_.search('foo bar',['here is foo','here is bar'])
```

Note, I have a dependency on underscorejs, specifically, this uses _.isArray, _.every, and _.some. I just use them, so it will fail if underscorejs isn't loaded. Is there a better/desired way to handle this?

Possible Todo's:
* Add a case-insensitive option. In my use now, I just call .toLowerCase() before passing.