export instantiation of util class
This commit is contained in:
parent
08f828b955
commit
cf93ff3231
12
lib/utils.js
12
lib/utils.js
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user