diff --git a/packages/typedoc-plugin-appium/lib/model/reflection/kind.ts b/packages/typedoc-plugin-appium/lib/model/reflection/kind.ts index 7b8b06f51..eb3b7cced 100644 --- a/packages/typedoc-plugin-appium/lib/model/reflection/kind.ts +++ b/packages/typedoc-plugin-appium/lib/model/reflection/kind.ts @@ -8,7 +8,37 @@ * @module */ -import {addReflectionKind} from './utils'; +/** + * Adapted from `@knodes/typedoc-pluginutils` + * @see https://github.com/knodescommunity/typedoc-plugins + * Copyright (c) 2022 KnodesCommunity + * Licensed MIT + * @see https://github.com/KnodesCommunity/typedoc-plugins/blob/05717565fae14357b1c4be8122f3156e1d46d332/LICENSE + * @module + */ + +import {ReflectionKind} from 'typedoc'; + +const getHigherBitMask = () => + Math.max( + ...Object.values({...ReflectionKind, All: -1}) + .filter((value) => typeof value === 'number') + .map((v) => v.toString(2)) + .filter((v) => v.match(/^0*10*$/)) + .map((v) => parseInt(v, 2)) + ); + +function addReflectionKind(name: string, value?: number | null) { + const kindAny = ReflectionKind as any; + const existingValue = kindAny[name]; + if (existingValue !== null && existingValue !== undefined) { + return existingValue; + } + const defaultedValue = value ?? getHigherBitMask() * 2; + kindAny[name] = defaultedValue; + kindAny[defaultedValue] = name; + return defaultedValue; +} /** * Extends the TypeDoc's `ReflectionKind` to add namespaced kinds diff --git a/packages/typedoc-plugin-appium/lib/model/reflection/utils.ts b/packages/typedoc-plugin-appium/lib/model/reflection/utils.ts deleted file mode 100644 index 4947e6241..000000000 --- a/packages/typedoc-plugin-appium/lib/model/reflection/utils.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Adapted from `@knodes/typedoc-pluginutils` - * @see https://github.com/knodescommunity/typedoc-plugins - * Copyright (c) 2022 KnodesCommunity - * Licensed MIT - * @see https://github.com/KnodesCommunity/typedoc-plugins/blob/05717565fae14357b1c4be8122f3156e1d46d332/LICENSE - * @module - */ - -import {ReflectionKind} from 'typedoc'; - -const getHigherBitMask = () => - Math.max( - ...Object.values({...ReflectionKind, All: -1}) - .filter((value) => typeof value === 'number') - .map((v) => v.toString(2)) - .filter((v) => v.match(/^0*10*$/)) - .map((v) => parseInt(v, 2)) - ); -export const addReflectionKind = (name: string, value?: number | null) => { - const kindAny = ReflectionKind as any; - const existingValue = kindAny[name]; - if (existingValue !== null && existingValue !== undefined) { - return existingValue; - } - const defaultedValue = value ?? getHigherBitMask() * 2; - kindAny[name] = defaultedValue; - kindAny[defaultedValue] = name; - return defaultedValue; -};