mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-28 13:13:37 +08:00
`manage_node_deps.py` was changed in https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2259834 to add line endings at the end of the package.json file However, `npm run install-deps` was not rerun to add the line endings. To prevent future CLs that add deps to include the line ending changes, fix them in this CL. R=mathias@chromium.org Change-Id: Id4ee0003520c4aa0cb55494cdf64df57e31a86d7 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2263952 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Mathias Bynens <mathias@chromium.org>
parse-json 
Parse JSON with more helpful errors
Install
$ npm install --save parse-json
Usage
var parseJson = require('parse-json');
var json = '{\n\t"foo": true,\n}';
JSON.parse(json);
/*
undefined:3
}
^
SyntaxError: Unexpected token }
*/
parseJson(json);
/*
JSONError: Trailing comma in object at 3:1
}
^
*/
parseJson(json, 'foo.json');
/*
JSONError: Trailing comma in object at 3:1 in foo.json
}
^
*/
// you can also add the filename at a later point
try {
parseJson(json);
} catch (err) {
err.fileName = 'foo.json';
throw err;
}
/*
JSONError: Trailing comma in object at 3:1 in foo.json
}
^
*/
API
parseJson(input, [reviver], [filename])
input
Type: string
reviver
Type: function
Prescribes how the value originally produced by parsing is transformed, before being returned. See JSON.parse docs for more.
filename
Type: string
Filename displayed in the error message.
License
MIT © Sindre Sorhus