A library for parsing the WHERE clause of an SQL-like string into an abstract syntax tree (AST), with support for converting to MongoDB queries, arrays for HTML rendering, or custom structures via an evaluator function. Current stable version is 2.2.1, updated in 2021. Lightweight, with no dependencies, and supports unary, binary, and ternary operators. Differentiators include built-in AST, array, and MongoDB output without additional converters, and an evaluator callback for custom transformations.
npm install sql-where-parserNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses SQL WHERE clause into AST and converts to MongoDB query format.
Implement custom evaluator for functions or preprocess the string.
Use double quotes around string literals in SQL input.
Ensure decimal numbers are written without unnecessary leading zeros.
Use SqlWhereParser.Operator type check or .valueOf() to get operator string.
Use `import SqlWhereParser from 'sql-where-parser'`.
Ensure package is installed: `npm install sql-where-parser` and import correctly.
Use double quotes for string literals in the WHERE clause.
No dependency data recorded yet.