machinepack-util
Advanced tools
Comparing version 0.6.1 to 0.7.0
@@ -23,2 +23,6 @@ module.exports = { | ||
}, | ||
couldNotParse: { | ||
description: 'Could not parse provided string- must be a valid JSON string.', | ||
extendedDescription: 'Oftentimes this error is a result of not using double-quotes. Refer to the official JSON specification at http://www.json.org/ for more information.' | ||
}, | ||
success: { | ||
@@ -32,5 +36,12 @@ description: 'Done.', | ||
fn: function(inputs, exits) { | ||
return exits.success(JSON.parse(inputs.json)); | ||
var parsedJson; | ||
try { | ||
parsedJson = JSON.parse(inputs.json); | ||
} | ||
catch (e){ | ||
return exits.couldNotParse(e); | ||
} | ||
return exits.success(parsedJson); | ||
}, | ||
}; |
{ | ||
"name": "machinepack-util", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"description": "Utilities for working with arrays, dictionaries, strings, etc.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
17702
646