Download wp-calypso/apps/notifications/src/panel/utils/parse-json.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 255 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/notifications/src/panel/utils/parse-json.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/apps/notifications/src/panel/utils/parse-json.js
-
curl -L -o parse-json.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/notifications/src/panel/utils/parse-json.js
255 Bytes
| /** | |
| * Attempts to parse a string as JSON | |
| * @param {?string} input possible JSON string | |
| * @returns {*} parsed data or null on failure | |
| */ | |
| export const parseJson = ( input ) => { | |
| try { | |
| return JSON.parse( input ); | |
| } catch ( e ) { | |
| return null; | |
| } | |
| }; | |