cli-ching
Version:
CLI-CHING is a command-line interface tool for consulting the I Ching (Book of Changes). It provides a digital means of casting hexagrams and receiving interpretations, blending ancient wisdom with modern technology. It does not cast for you, you must bri
19 lines (15 loc) • 439 B
JavaScript
// config.js
const fs = require('fs');
const path = require('path');
const CONFIG_FILE = path.join(process.env.HOME || process.env.USERPROFILE, '.iching-throws');
function loadConfig() {
try {
return JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
} catch (error) {
return [];
}
}
function saveConfig(data) {
fs.writeFileSync(CONFIG_FILE, JSON.stringify(data, null, 2));
}
module.exports = { loadConfig, saveConfig };