13 lines
238 B
JavaScript
13 lines
238 B
JavaScript
|
const fs = require('fs').promises
|
||
|
|
||
|
module.exports = async function (file, defaults) {
|
||
|
let f
|
||
|
try {
|
||
|
f = await fs.readFile(file)
|
||
|
f = JSON.parse(f)
|
||
|
} catch (e) {
|
||
|
return defaults
|
||
|
}
|
||
|
return Object.assign({}, defaults, f)
|
||
|
}
|