From cf93ff3231f08641d58a97511bfd18892577dc92 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Mon, 25 Dec 2023 22:42:33 -0600 Subject: [PATCH] export instantiation of util class --- lib/utils.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index c9a4d96..f6140a2 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -8,8 +8,14 @@ import fs from "fs"; const dirTree = require("directory-tree"); -export class Util { - _counter = 0; +class Util { + _counter; + cachedSlugMap; + + constructor() { + this._counter = 0; + this.cachedSlugMap = this.getSlugHashMap(); + } getContent(slug) { let currentFilePath = toFilePath(slug) @@ -54,7 +60,6 @@ export class Util { } toFilePath(slug) { - const cachedSlugMap = getSlugHashMap() return cachedSlugMap[slug] } @@ -263,3 +268,4 @@ export class Util { } } +export default new Util()