jsonata: Provides its own types (#39583)

This commit is contained in:
Alexander T 2019-11-01 19:47:28 +02:00 committed by Jesse Trinity
parent 8b63e0de7b
commit 01f88afb81
5 changed files with 6 additions and 52 deletions

View File

@ -2046,6 +2046,12 @@
"sourceRepoURL": "https://github.com/mperdeck/jsnlog.js",
"asOfVersion": "2.17.2"
},
{
"libraryName": "jsonata",
"typingsPackageName": "jsonata",
"sourceRepoURL": "https://github.com/jsonata-js/jsonata",
"asOfVersion": "1.5.0"
},
{
"libraryName": "jsonschema",
"typingsPackageName": "jsonschema",

View File

@ -1,14 +0,0 @@
// Type definitions for jsonata 1.3
// Project: https://github.com/jsonata-js/jsonata, http://jsonata.org
// Definitions by: Nick <https://github.com/nick121212>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function jsonata(str: string): jsonata.Expression;
declare namespace jsonata {
interface Expression {
evaluate(input: any, bindings?: any, callback?: () => any): any;
assign(key: string, func: (...args: any[]) => any): void;
}
}
export = jsonata;

View File

@ -1,12 +0,0 @@
import jsonata = require("jsonata");
const data = {
example: [
{ value: 4 },
{ value: 7 },
{ value: 13 }
]
};
const expression = jsonata("$sum(example.value)");
const result = expression.evaluate(data); // returns 24

View File

@ -1,25 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"es6"
],
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jsonata-tests.ts"
]
}

View File

@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }