Skip to main content
Version: 0.4.12

JS Implementation

The JS implementation of MistQL can be installed via npm install mistql.

Example Usage:#

import { query } from 'mistql';
const len = query('count @', [1, 2, 3]);console.log(len);

mistql package exports#

ExporttypeDescription
query(query: string, data: any) => anyThe default query function for MistQL. Most uses of MistQL can rely solely on this function
defaultInstanceMistQLInstanceThe default instance of MistQL. The exported query function is an alias to the query method on the default instance
MistQLInstanceclassThe class for constructing parameterized MistQL instances. If you're adding custom functions to MistQL, you'll use this interface.
jsFunctionToMistQLFunction(fn) => FunctionValueHelper function for constructing MistQL functions from JS functions
default{query, defaultInstance, }An object consisting of the

MistQL also exposes a number of TS types through the default interface, although they're not listed here.

Type correspondence between JS and MistQL#

Separate from the specification of the language, the JS implementation maps from JS types to MistQL types in a specific manner, as documented by the table below. As the following is NOT part of the language, rather the library, the correspondence may change with further releases of the mistql package, following semver.

If this correspondence doesn't work for you for some reason, please open an issue and describe the situation carefully. This correspondence is easier to change than the language itself.

ValueMistQL ValueNotes
numbernumberInfinity and NaN casted to null
booleanboolean
stringstring
objectobject
nullnull
arrayarray
undefinednull
functionobject with enumerated properties
Number objectnumber
Boolean objectboolean
String objectstring
Datedate.toISOString()
Symbolsymbol.toString()
Anything elseobject with enumerated properties