You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

13 lines
317 B

'use strict';
module.exports = function (filepath, defaults) {
if (this.exists(filepath)) {
try {
return JSON.parse(this.read(filepath));
} catch (error) {
throw new Error('Could not parse JSON in file: ' + filepath + '. Detail: ' + error.message);
}
} else {
return defaults;
}
};