@rsql/emitter
TypeScript icon, indicating that this package has built-in type declarations

1.6.0 • Public • Published

@rsql/emitter

RSQL emitter for Node.js and Browsers

npm lerna code style: prettier commitizen friendly tested with jest auto release

Installation

# with npm
npm install --save @rsql/emitter

# with yarn
yarn add @rsql/emitter

API

emit(expression: ExpressionNode, options?: EmitOptions): string

Emits RSQL string from the Abstract Syntax Tree. The second parameter to emit is an optional object with the following fields:

  • preferredQuote - Optional string. The preferred quote character to use when emit encounters a comparison value that needs to be escaped by wrapping in quotes. Either " (the ASCII double quote character) or ' (the ASCII single quote character). Defaults to " (the ASCII double quote character).

  • optimizeQuotes - Optional boolean. If true, emit will override the preferredQuote setting on a comparison value-by-comparison value basis if doing so would shorten the emitted RSQL. If false, emit will use the preferredQuote as the quote character for all comparison values encountered. Defaults to true.

emit can throw the following errors:

  • TypeError - in the case of invalid argument type passed to the emit function

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @rsql/emitter

Weekly Downloads

4,283

Version

1.6.0

License

MIT

Unpacked Size

20.9 kB

Total Files

8

Last publish

Collaborators

  • piotr-oles