
Research
/Security News
Fake imToken Chrome Extension Steals Seed Phrases via Phishing Redirects
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.
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
The npm package scour-search receives a total of 1 weekly downloads. As such, scour-search popularity was classified as not popular.
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.

Research
/Security News
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.