From e0db9c5494369cc59249698c1851088e9e3b28dc Mon Sep 17 00:00:00 2001 From: Glen Van Ginkel Date: Sun, 31 May 2020 23:32:19 +0100 Subject: [PATCH] Compile actually returns something useful --- package-lock.json | 2 +- package.json | 2 +- src/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 70ca058..7386901 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@metrichor/jmespath", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b610979..312e080 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@metrichor/jmespath", "description": "Typescript implementation of the JMESPath spec (100% compliant)", - "version": "0.1.1", + "version": "0.1.2", "author": { "name": "Oxford Nanopore Technologies", "email": "support@nanoporetech.com", diff --git a/src/index.ts b/src/index.ts index 57bd431..74ccc93 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,9 +21,9 @@ 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 { +export function compile(expression: string): (data: JSONValue) => JSONValue { const nodeTree = Parser.parse(expression); - return nodeTree; + return (data: JSONValue) => TreeInterpreter.search(nodeTree, data); } export function tokenize(expression: string): LexerToken[] {