jsonstring
v0.1.2
Published
Stores a JSON string as an object.
Downloads
3
Readme
jsonstring
Stores a JSON string. Allows it to be used in a more object-oriented manner than simply passing around a raw string.
Requires Node 4 with harmony features. Strong mode is suggested.
JsonString.create(value) => jsonString or undefined;
Create a JsonString object from a value. If value is undefined then returns undefined.
JSonString.stringify(value) => jsonString;
Creates a JsonString object from a value. If value is undefined then treats it as null.
JsonString.recreate(json) => jsonString or undefined;
Creates a JsonString object from a JSON string. If there is a parse error then returns undefined.
JsonString.restringify(json) => jsonString;
Creates a JsonString object from a JSON string. If there is a parse error then treats it as null.
jsonString.valueOf() => json;
Returns the json string stored by the instance.
jsonString.parse() => value;
Returns the value of the json string stored by the instance.
jsonString.tryParse() => value or undefined;
Returns the value of the json string stored by the instance. If there is a parse error then returns undefined.
License
ISC