Add types for jsonabc

This commit is contained in:
Florian Keller 2019-01-10 22:17:54 +01:00
parent 70fe269343
commit f39fd15de1
No known key found for this signature in database
GPG Key ID: 5570D938BDA00C34
4 changed files with 53 additions and 0 deletions

20
types/jsonabc/index.d.ts vendored Normal file
View File

@ -0,0 +1,20 @@
// Type definitions for jsonabc 2.3
// Project: http://novicelab.org/jsonabc
// Definitions by: Florian Keller <https://github.com/ffflorian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/**
* Sort the JSON (clean, parse, sort, stringify).
* @param noArray Sort or don't sort arrays
*/
export function sort(inputStr: string, noArray?: boolean): string;
/**
* Sort the JSON (clean, parse, sort, stringify).
* @param noArray Sort or don't sort arrays
*/
export function sortObj(input: object, noArray?: boolean): object;
/** Remove trailing commas */
export function cleanJSON(input: string): string;

View File

@ -0,0 +1,9 @@
import * as myJsonAbc from 'jsonabc';
myJsonAbc.sortObj({ c: 0, b: 1, a: 0 });
myJsonAbc.sortObj({ c: 0, b: 1, a: 0 }, false);
myJsonAbc.sort('{ c: 0, b: 1, a: 0 }');
myJsonAbc.sort('{ c: 0, b: 1, a: 0 }', true);
myJsonAbc.cleanJSON('{ c: 0, b: 1, a: 0 }');

View File

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

View File

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