| Commit message (Expand) | Author | Age | Files | Lines | |
|---|---|---|---|---|---|
| * | Copy editing | Adam Soltys | 2012-11-27 | 1 | -31/+68 |
| * | Static pages | Adam Soltys | 2012-11-26 | 4 | -30/+241 |
| * | Password authentication | Adam Soltys | 2012-11-20const fs = require("fs");
module.exports = (path, initial = {}) => {
if (!initial || !Object.keys(initial).length) {
try {
initial = require("../" + path);
} catch(e) {}
}
return new Proxy(initial, {
set(obj, prop, value) {
fs.writeFileSync(
path,
JSON.stringify({ ...obj, [prop]: value }, null, 2),
"utf-8"
);
return Reflect.set(...arguments);
}
});
};
|
