(filepath)
| 8 | try {return fs.readFileSync(filepath, "utf8")} catch (e) {throw new Error("File does not exist: " + filepath)} |
| 9 | } |
| 10 | function isFile(filepath) { |
| 11 | try {return fs.statSync(filepath).isFile()} catch (e) {return false} |
| 12 | } |
| 13 | function parse(file) { |
| 14 | var json = read(file) |
| 15 | try {return JSON.parse(json)} catch (e) {throw new Error("invalid JSON: " + json)} |