From 7bf6ff373d315f506e4823b9bfa78ce980731dfa Mon Sep 17 00:00:00 2001 From: joe fleming Date: Thu, 28 Feb 2019 17:15:31 -0700 Subject: [PATCH] feat: allow customizing history json filename --- src/lib/history.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/history.mjs b/src/lib/history.mjs index 204d823..2fc9a01 100644 --- a/src/lib/history.mjs +++ b/src/lib/history.mjs @@ -5,8 +5,8 @@ const MAX_ITEMS = 1000; // max entries in history const TRUNCATE_AMOUNT = 200; // count of entries to remove when max is hit export default class History { - constructor() { - this.filePath = path.resolve('data', 'history.json'); + constructor(filename = 'history.json') { + this.filePath = path.resolve('data', filename); try { const data = fs.readFileSync(this.filePath); this.db = data.length === 0 ? [] : JSON.parse(data);