diff --git a/src/value/array.ts b/src/value/array.ts index 85c775b..cf97a2c 100644 --- a/src/value/array.ts +++ b/src/value/array.ts @@ -10,34 +10,7 @@ import {ValueInteger} from './integer'; import {ValueReal} from './real'; import {ValueString} from './string'; -let getChildTagNamesCache: Map Value> | null = null; - -/** - * Get child tag names. - * - * @returns The map. - */ -const getChildTagNames = () => { - if (!getChildTagNamesCache) { - getChildTagNamesCache = new Map(); - for (const Value of [ - // eslint-disable-next-line @typescript-eslint/no-use-before-define - ValueArray, - ValueBoolean, - ValueData, - ValueDate, - ValueDict, - ValueInteger, - ValueReal, - ValueString - ]) { - for (const t of Value.TAG_NAMES) { - getChildTagNamesCache.set(t, Value); - } - } - } - return getChildTagNamesCache; -}; +let childTagNames: Map Value>; /** * ValueArray object. @@ -59,7 +32,24 @@ export class ValueArray extends Value { * @returns Child tag names map. */ public static get CHILD_TAG_NAMES() { - return getChildTagNames(); + if (!childTagNames) { + childTagNames = new Map(); + for (const Value of [ + ValueArray, + ValueBoolean, + ValueData, + ValueDate, + ValueDict, + ValueInteger, + ValueReal, + ValueString + ]) { + for (const t of Value.TAG_NAMES) { + childTagNames.set(t, Value); + } + } + } + return childTagNames; } /** diff --git a/src/value/dict.ts b/src/value/dict.ts index bf98ef7..03594b2 100644 --- a/src/value/dict.ts +++ b/src/value/dict.ts @@ -10,34 +10,7 @@ import {ValueInteger} from './integer'; import {ValueReal} from './real'; import {ValueString} from './string'; -let getChildTagNamesCache: Map Value> | null = null; - -/** - * Get child tag names. - * - * @returns The map. - */ -const getChildTagNames = () => { - if (!getChildTagNamesCache) { - getChildTagNamesCache = new Map(); - for (const Value of [ - ValueArray, - ValueBoolean, - ValueData, - ValueDate, - // eslint-disable-next-line @typescript-eslint/no-use-before-define - ValueDict, - ValueInteger, - ValueReal, - ValueString - ]) { - for (const t of Value.TAG_NAMES) { - getChildTagNamesCache.set(t, Value); - } - } - } - return getChildTagNamesCache; -}; +let childTagNames: Map Value>; /** * ValueDict object. @@ -59,7 +32,24 @@ export class ValueDict extends Value { * @returns Child tag names map. */ public static get CHILD_TAG_NAMES() { - return getChildTagNames(); + if (!childTagNames) { + childTagNames = new Map(); + for (const Value of [ + ValueArray, + ValueBoolean, + ValueData, + ValueDate, + ValueDict, + ValueInteger, + ValueReal, + ValueString + ]) { + for (const t of Value.TAG_NAMES) { + childTagNames.set(t, Value); + } + } + } + return childTagNames; } /**