@knodes/typedoc-pluginutils
Version:
A set of utilities for TypeDoc plugins
24 lines • 1 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.addReflectionKind = void 0;
const lodash_1 = require("lodash");
const typedoc_1 = require("typedoc");
const getHigherBitMask = () => Math.max(...Object.values(Object.assign(Object.assign({}, typedoc_1.ReflectionKind), { All: -1 }))
.filter(lodash_1.isNumber)
.map(v => v.toString(2))
.filter(v => v.match(/^0*10*$/))
.map(v => parseInt(v, 2)));
const addReflectionKind = (ns, name, value) => {
const fullName = `${ns}:${name}`;
const kindAny = typedoc_1.ReflectionKind;
const existingValue = kindAny[fullName];
if (!(0, lodash_1.isNil)(existingValue)) {
return existingValue;
}
const defaultedValue = value !== null && value !== void 0 ? value : (getHigherBitMask() * 2);
kindAny[fullName] = defaultedValue;
kindAny[defaultedValue] = fullName;
return defaultedValue;
};
exports.addReflectionKind = addReflectionKind;
//# sourceMappingURL=reflection-kind.js.map
;