Comparing version 1.0.5 to 1.1.0
@@ -7,2 +7,2 @@ export interface ParsedJson { | ||
export declare function getAstByString(jsonString: string, json?: any): ParsedJson; | ||
export declare function getAstByObject(json: any): ParsedJson; | ||
export declare function getAstByObject(json: any, indent?: number): ParsedJson; |
@@ -14,6 +14,6 @@ "use strict"; | ||
exports.getAstByString = getAstByString; | ||
function getAstByObject(json) { | ||
const jsonString = JSON.stringify(json, null, 4); | ||
function getAstByObject(json, indent = 4) { | ||
const jsonString = JSON.stringify(json, null, indent); | ||
return getAstByString(jsonString); | ||
} | ||
exports.getAstByObject = getAstByObject; |
{ | ||
"name": "jsonpos", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "Get the textual position of a property in a JSON text", | ||
@@ -5,0 +5,0 @@ "author": "Gustaf Räntilä", |
@@ -133,2 +133,8 @@ [![npm version][npm-image]][npm-url] | ||
`getAstByObject` takes an optional second argument `indent` which can be set to something else than `4` if necessary, e.g. `2`: | ||
```ts | ||
const ast = getAstByObject( { foo: "bar" }, 2 ); | ||
``` | ||
### getLocation | ||
@@ -135,0 +141,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10803
9
165