diff --git a/jmespath/index.d.ts b/jmespath/index.d.ts new file mode 100644 index 0000000000..a460fd6a4d --- /dev/null +++ b/jmespath/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for jmespath 0.15 +// Project: https://github.com/jmespath/jmespath.js +// Definitions by: Jeffery Grajkowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Take a JSON document and transform it into another JSON document + * through a JMESPath expression. See: http://jmespath.org/ + * @param jsonDoc the document to transform + * @param query a JMESPath expression + * @return the transformed document + */ +export function search(jsonDoc: any, query: string): any; diff --git a/jmespath/jmespath-tests.ts b/jmespath/jmespath-tests.ts new file mode 100644 index 0000000000..04034acf67 --- /dev/null +++ b/jmespath/jmespath-tests.ts @@ -0,0 +1,6 @@ +import jmespath = require("jmespath"); + +const a = jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar.baz[2]"); +const b = jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar") +const c = jmespath.search({"foo": [{"first": "a", "last": "b"}, {"first": "c", "last": "d"}]}, "foo[*].first"); +const d = jmespath.search({"foo": [{"age": 20}, {"age": 25}, {"age": 30}, {"age": 35}, {"age": 40}]}, "foo[?age > `30`]"); diff --git a/jmespath/tsconfig.json b/jmespath/tsconfig.json new file mode 100644 index 0000000000..7db8ecc248 --- /dev/null +++ b/jmespath/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jmespath-tests.ts" + ] +} diff --git a/jmespath/tslint.json b/jmespath/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/jmespath/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file