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()