export instantiation of util class

This commit is contained in:
Triston Armstrong 2023-12-25 22:42:33 -06:00
parent 08f828b955
commit cf93ff3231

View File

@ -8,8 +8,14 @@ import fs from "fs";
const dirTree = require("directory-tree"); const dirTree = require("directory-tree");
export class Util { class Util {
_counter = 0; _counter;
cachedSlugMap;
constructor() {
this._counter = 0;
this.cachedSlugMap = this.getSlugHashMap();
}
getContent(slug) { getContent(slug) {
let currentFilePath = toFilePath(slug) let currentFilePath = toFilePath(slug)
@ -54,7 +60,6 @@ export class Util {
} }
toFilePath(slug) { toFilePath(slug) {
const cachedSlugMap = getSlugHashMap()
return cachedSlugMap[slug] return cachedSlugMap[slug]
} }
@ -263,3 +268,4 @@ export class Util {
} }
} }
export default new Util()