From b0edc945feaf6ce6ef37b4a60e105d56b4320b51 Mon Sep 17 00:00:00 2001 From: Glen Van Ginkel Date: Fri, 15 May 2020 18:06:29 +0100 Subject: [PATCH] fix(src/index.ts): export argument types Export argument types as named arguments so that you don't have to import the default export to use them --- src/index.ts | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/index.ts b/src/index.ts index ee72e59..57bd431 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,6 +10,17 @@ import { RuntimeFunction, } from './typings/index'; +export const TYPE_ANY = InputArgument.TYPE_ANY; +export const TYPE_ARRAY = InputArgument.TYPE_ARRAY; +export const TYPE_ARRAY_NUMBER = InputArgument.TYPE_ARRAY_NUMBER; +export const TYPE_ARRAY_STRING = InputArgument.TYPE_ARRAY_STRING; +export const TYPE_BOOLEAN = InputArgument.TYPE_BOOLEAN; +export const TYPE_EXPREF = InputArgument.TYPE_EXPREF; +export const TYPE_NULL = InputArgument.TYPE_NULL; +export const TYPE_NUMBER = InputArgument.TYPE_NUMBER; +export const TYPE_OBJECT = InputArgument.TYPE_OBJECT; +export const TYPE_STRING = InputArgument.TYPE_STRING; + export function compile(expression: string): ExpressionNodeTree { const nodeTree = Parser.parse(expression); return nodeTree; @@ -33,20 +44,20 @@ export function search(data: JSONValue, expression: string): JSONValue { } export const jmespath = { - search, compile, - tokenize, registerFunction, - TYPE_NUMBER: InputArgument.TYPE_NUMBER, - TYPE_ANY: InputArgument.TYPE_ANY, - TYPE_STRING: InputArgument.TYPE_STRING, - TYPE_ARRAY: InputArgument.TYPE_ARRAY, - TYPE_OBJECT: InputArgument.TYPE_OBJECT, - TYPE_BOOLEAN: InputArgument.TYPE_BOOLEAN, - TYPE_EXPREF: InputArgument.TYPE_EXPREF, - TYPE_NULL: InputArgument.TYPE_NULL, - TYPE_ARRAY_NUMBER: InputArgument.TYPE_ARRAY_NUMBER, - TYPE_ARRAY_STRING: InputArgument.TYPE_ARRAY_STRING, + search, + tokenize, + TYPE_ANY, + TYPE_ARRAY_NUMBER, + TYPE_ARRAY_STRING, + TYPE_ARRAY, + TYPE_BOOLEAN, + TYPE_EXPREF, + TYPE_NULL, + TYPE_NUMBER, + TYPE_OBJECT, + TYPE_STRING, }; export default jmespath;