1.0.5 • Published 9 years ago

json-tryparse v1.0.5

Weekly downloads
34
License
ISC
Repository
github
Last release
9 years ago

Json TryParse

Build Status

npm install json-tryparse

A small extension of the native JSON class to have methods that can handle a parse or stringify even if the object already are one or another.

Background

In projects where there are several developers working we've often been in situation where everybody doesn't know if the object passing around after we've called some api is the parsed json object or the stringified object as string.

To be able to handle this I've implemented a simple extension of the native JSON class.

Usage

require('json-tryparse');

Parsing to object

Instead of

JSON.parse(variable);

use

JSON.tryParse(variable);

Stringify

Instead of

JSON.stringify(variable);

use

JSON.tryStringify(variable);

Run tests

npm test

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago