mirror of
https://github.com/scratchfoundation/scratch-parser.git
synced 2025-06-28 07:30:33 -04:00
Refactors library to use latest scratch eslint rules. Updates all dependencies to latest versions which requires minor changes to the JSON schema, tests, and supported engine (8+) BREAKING CHANGE: Module no longer supports less than Node 8
17 lines
606 B
JavaScript
17 lines
606 B
JavaScript
/**
|
|
* Converts string from unpack method into a project object. Note: this method
|
|
* will be expanded greatly in the future in order to support the Scratch 1.4
|
|
* file format. For now, this is nothing but an (awkward) async wrapper around
|
|
* the `JSON.parse` function.
|
|
* @param {string} input Stringified JSON object
|
|
* @param {Function} callback Returns error or parsed JSON object
|
|
* @return {void}
|
|
*/
|
|
module.exports = function (input, callback) {
|
|
try {
|
|
var result = JSON.parse(input);
|
|
callback(null, result);
|
|
} catch (e) {
|
|
return callback(e.toString());
|
|
}
|
|
};
|