Registry / search / searchjs

searchjs

JSON →
library1.1.2jsnpmunverified

A JavaScript library for filtering objects using jsql, a JSON-based query language similar to SQL. Current stable version is 1.1.2, release cadence is low (last update years ago). Key differentiator: allows querying plain JavaScript objects with dot-notation, range queries, and logical operators without a database. Lightweight, no dependencies.

npm install searchjs
INSTALL
IMPORT
SIG · SEARCHJS
S
searchjs
searchjavascriptv1.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

searchjs
import searchjs from 'searchjs'
const searchjs = require('searchjs')
ESM import works in modern environments; CommonJS require is also supported.
match
import { match } from 'searchjs'
The match function is exported as a named export from the package.
matchArray
import { matchArray } from 'searchjs'
matchArray returns an array of matching objects.

Demonstrates filtering an array of objects using a jsql query with case-insensitive matching and deep dot-notation.

import searchjs from 'searchjs'; const data = [ { name: 'John', age: 30, cars: [{ brand: 'bmw', hp: 250 }] }, { name: 'Jane', age: 25, cars: [{ brand: 'audi', hp: 200 }] } ]; const query = { name: 'john', 'cars.brand': 'bmw' }; const results = searchjs.matchArray(data, query); console.log(results); // Output: [ { name: 'John', age: 30, cars: [{ brand: 'bmw', hp: 250 }] } ]
Debug
Known issues
gotchaString comparisons are case-insensitive by default.
fix
Use a custom filter or modify source if case-sensitive matching is needed.
affects: *
gotchaWhen using range queries with 'from' and 'to', the object must have exactly those keys; 'from' is inclusive, 'to' is exclusive.
fix
Ensure range object format: { from: value1, to: value2 }.
affects: *
gotchaDeep searching with arrays matches if any element in the array satisfies the condition.
fix
Be aware that arrays are treated as OR conditions within the path.
affects: *
deprecatedThe package has not been updated in years; no known breaking changes but no active maintenance.
fix
Consider migrating to a more modern alternative if new features are needed.
affects: <=1.1.2
Errors
Common errors & fixes
Uncaught TypeError: searchjs.matchArray is not a function
Importing the default export instead of named export matchArray.
fix
Use `import { matchArray } from 'searchjs'` instead of `import searchjs from 'searchjs'` when calling matchArray directly.
TypeError: Cannot read properties of undefined (reading 'match')
Using the library on a non-object or non-array argument.
fix
Ensure data is an object or array before calling match functions.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
24
OpenAI (training)
1
Resources
searchjs — npm install searchjs · libregistry