diff options
Diffstat (limited to 'node_modules/json-parse-helpfulerror/README.md')
-rw-r--r-- | node_modules/json-parse-helpfulerror/README.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/node_modules/json-parse-helpfulerror/README.md b/node_modules/json-parse-helpfulerror/README.md new file mode 100644 index 000000000..ffad93584 --- /dev/null +++ b/node_modules/json-parse-helpfulerror/README.md @@ -0,0 +1,29 @@ +# json-parse-helpfulerror + +A drop-in replacement for `JSON.parse` that uses +<https://npmjs.org/jju> to provide more useful error messages in the +event of a parse error. + +# Example + +## Installation + +``` +npm i -S json-parse-helpfulerror +``` + +## Use + +```js +var jph = require('json-parse-helpfulerror'); + +var notJSON = "{'foo': 3}"; // keys must be double-quoted in JSON + +JSON.parse(notJSON); // throws unhelpful error + +jph.parse("{'foo': 3}") // throws more helpful error: "Unexpected token '\''..." +``` + +# License + +MIT
\ No newline at end of file |