The `logic-query-parser` package provides a JavaScript utility for parsing logic search strings into a binary tree representation. It takes a query string, supports `AND`, `OR`, parentheses, and double quotes, and can be configured with custom space characters and a default operator. Additionally, it offers a utility function to convert the binary tree into a more usable JSON query form, simplifying programmatic interpretation. This package is currently at version 0.0.5 and was last published approximately 7 years ago, indicating it is no longer actively maintained. Its primary use case is to transform human-readable logical expressions into a structured data format suitable for backend search or filtering operations.
npm install logic-query-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates parsing a complex logic query into a binary tree and then converting it to a simplified JSON query structure, also showing how to use custom parsing options.
Use `const parser = require('logic-query-parser');` for importing the module.Consider migrating to a more actively maintained logic parsing library for new projects or critical applications. Evaluate existing implementations carefully for stability and security vulnerabilities.
If providing options, ensure the options object is the first argument: `parser.parse(options, 'my query')`. If no options, pass the string directly: `parser.parse('my query')`.Import the entire `parser` object first: `const parser = require('logic-query-parser');` then call `parser.parse(...)`.Use CommonJS `require` syntax: `const parser = require('logic-query-parser');`. If modern ESM syntax is mandatory, consider a build step (e.g., Webpack, Rollup) to transpile or find an alternative library.No dependency data recorded yet.