@thinql/parse
v0.2.0
Published
Parse ThinQL queries to ASTs
Downloads
1
Maintainers
Readme
@thinql/parse
Parse ThinQL queries to ASTs
Installation
# npm
npm install @thinql/parse
# yarn
yarn add @thinql/parse
Example
import assert from 'assert'
import isEqual from 'lodash.isequal'
import parse from '@thinql/parse'
const result = parse('hello world')
assert(result.toString() === 'hello world')
assert(isEqual(result.toJSON(), {
$type: 'Statement',
expression: [
{
$type: 'LogicalAndExpression',
assertions: [
{
$type: 'Assertion',
assertion: {
$type: 'FullTextSearch',
value: {
$type: 'Value',
content: 'hello',
literal: false,
},
},
negated: false,
},
{
$type: 'Assertion',
assertion: {
$type: 'FullTextSearch',
value: {
$type: 'Value',
content: 'world',
literal: false,
},
},
negated: false,
},
],
},
],
}))