mirror of
https://github.com/kennethreitz/bake.git
synced 2026-06-05 23:00:17 +00:00
14 lines
317 B
JavaScript
14 lines
317 B
JavaScript
'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;
|
|
}
|
|
};
|