
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
scour-search
Advanced tools
Indexed searching
import Searcher from 'scour-search'
data =
{ 1: { name: 'Homer', gender: 'm' },
2: { name: 'Marge', gender: 'f' },
3: { name: 'Bart', gender: 'm' } }
search = Searcher(data)
.index('name')
search.filter({ gender: 'm' })
// => { 1: { name: 'Homer', gender: 'm' },
// 3: { name: 'Bart', gender: 'm' } }
Supported operations (fast): $or, $and, $not, $nor, $in, $nin, $eq, $ne.
Supported operations (slow): $lt, $gt, $gte, $lte, $exists, $regex, $where, $size, $mod.
search.filter({ $or: [ {name: 'Homer'}, {gender: 'f'} ] })
Use reindex() to tell scour-search that there's updated data. It works immutably.
data = { ... }
search = ss(data).index('name')
newData = { ...data, 4: { name: 'John' } }
search = search.reindex(newData, 4)
// `4` is the key of the new entry
scour-search works for both Arrays and array-like Objects. Performance is much faster with Objects (see benchmarks).
// array
data = [
{ symbol: 'AAPL', name: 'Apple' },
{ symbol: 'MSFT', name: 'Microsoft' },
{ symbol: 'FB', name: 'Facebook' }
]
// object
data = {
aapl: { symbol: 'AAPL', name: 'Apple' },
msft: { symbol: 'MSFT', name: 'Microsoft' },
fb: { symbol: 'FB', name: 'Facebook' }
}
searching (n=512)
x 44221 op/sec - indexed, array
x 405108 op/sec - indexed, object
x 21761 op/sec - unindexed, array
x 6104 op/sec - via sift.js
x 37525 op/sec - native Array.filter()
Searcher(data)
Creates a searcher object where you can search given data.
import Searcher from 'scour-search'
data = [ { symbol: 'AAPL' }, { symbol: 'MSFT' } ]
search = Searcher(data)
search.filter({ symbol: 'AAPL' })
// Add indexing via .index()
search = search.index('symbol')
search.filter({ symbol: 'AAPL' })
index(field, type)
Creates an index for the field field. This allows searches against this
field to be faster.
This function is mutative; it will modify the current Searcher instance.
data = [
{ name: 'John' }, { name: 'Paul' }
]
search = Searcher(data)
search.filter({ name: 'John' }) // ...slow (no index)
search = Searcher(data).index('name')
search.filter({ name: 'John' }) // ...fast
reindex(newData, keys)
Given new newData, update the indices for keys. The parameter keys
can be an array, a number, or a string.
The parameter newData must be different from data, but based off of
it. (scour-search is biased towards immutable workflows.)
data = [ { name: 'john' } ]
search = Searcher(data).index('name')
// An addition at key `1`
newData = [ { name: 'john' }, { name: 'ringo' } ]
search = search.reindex(newData, 1)
// An deletion at key `1`
newData = [ { name: 'john' } ]
search = search.reindex(newData, 1)
filter(condition)
Performs a query. Supports some MongoDB-style filters.
search = Searcher(data)
search.filter({ name: 'John' })
search.filter({ name: { $eq: 'John' } })
search.filter({ name: { $in: ['John', 'George'] } })
indexOf(condition)
Returns the index. If it's not found, returns -1. For arrays, it will
return a numeric index. For objects, it will return the key string of the
match.
search = Searcher([ { id: 'AAPL' }, { id: 'GOOG' } ])
search.indexOf({ id: 'GOOG' }) // => 1
search = Searcher({ aapl: { name: 'Apple' } })
search.indexOf({ name: 'Apple' }) // => 'aapl'
filterKeys(condition)
Performs a query, and only returns keys.
scour-search © 2015+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz
FAQs
Fast searching
We found that scour-search demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.