项目原始demo,不改动
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # json-parse-better-errors [![npm version](https://img.shields.io/npm/v/json-parse-better-errors.svg)](https://npm.im/json-parse-better-errors) [![license](https://img.shields.io/npm/l/json-parse-better-errors.svg)](https://npm.im/json-parse-better-errors) [![Travis](https://img.shields.io/travis/zkat/json-parse-better-errors.svg)](https://travis-ci.org/zkat/json-parse-better-errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/json-parse-better-errors?svg=true)](https://ci.appveyor.com/project/zkat/json-parse-better-errors) [![Coverage Status](https://coveralls.io/repos/github/zkat/json-parse-better-errors/badge.svg?branch=latest)](https://coveralls.io/github/zkat/json-parse-better-errors?branch=latest)
  2. [`json-parse-better-errors`](https://github.com/zkat/json-parse-better-errors) is a Node.js library for
  3. getting nicer errors out of `JSON.parse()`, including context and position of the parse errors.
  4. ## Install
  5. `$ npm install --save json-parse-better-errors`
  6. ## Table of Contents
  7. * [Example](#example)
  8. * [Features](#features)
  9. * [Contributing](#contributing)
  10. * [API](#api)
  11. * [`parse`](#parse)
  12. ### Example
  13. ```javascript
  14. const parseJson = require('json-parse-better-errors')
  15. parseJson('"foo"')
  16. parseJson('garbage') // more useful error message
  17. ```
  18. ### Features
  19. * Like JSON.parse, but the errors are better.
  20. ### Contributing
  21. The npm team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! The [Contributor Guide](CONTRIBUTING.md) has all the information you need for everything from reporting bugs to contributing entire new features. Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.
  22. All participants and maintainers in this project are expected to follow [Code of Conduct](CODE_OF_CONDUCT.md), and just generally be excellent to each other.
  23. Please refer to the [Changelog](CHANGELOG.md) for project history details, too.
  24. Happy hacking!
  25. ### API
  26. #### <a name="parse"></a> `> parse(txt, ?reviver, ?context=20)`
  27. Works just like `JSON.parse`, but will include a bit more information when an
  28. error happens.