@jsonquerylang/jsonquery
Version:
A small, flexible, and expandable JSON query language
23 lines • 1.09 kB
TypeScript
import type { JSONQuery, JSONQueryStringifyOptions } from './types';
/**
* Stringify a JSON Query into a readable, human friendly text syntax.
*
* Example:
*
* const jsonQuery = [
* ['get', 'friends'],
* ['filter', ['eq', ['get', 'city'], 'New York']],
* ['sort', ['get', 'age']],
* ['pick', ['get', 'name'], ['get', 'age']]
* ]
* const textQuery = stringify(jsonQuery)
* // textQuery = '.friends | filter(.city == "new York") | sort(.age) | pick(.name, .age)'
*
* @param query The JSON Query to be stringified
* @param {Object} [options] An object which can have the following options:
* `maxLineLength` Optional maximum line length. When the query exceeds this maximum,
* It will be formatted over multiple lines. Default value: 40.
* `indentation` Optional indentation. Defaults to a string with two spaces: ' '.
*/
export declare const stringify: (query: JSONQuery, options?: JSONQueryStringifyOptions) => any;
//# sourceMappingURL=stringify.d.ts.map