UNPKG

@inversifyjs/core

Version:

InversifyJs core package

17 lines 941 B
function getLifecycleSetUnion(extend, baseSet, currentSet) { if (extend) { return new Set([...baseSet, ...currentSet]); } return currentSet; } export function getExtendedLifecycle(options, baseTypeClassMetadata, typeMetadata) { const extendPostConstructMethods = options.lifecycle?.extendPostConstructMethods ?? true; const extendPreDestroyMethods = options.lifecycle?.extendPreDestroyMethods ?? true; const preDestroyMethodNames = getLifecycleSetUnion(extendPreDestroyMethods, baseTypeClassMetadata.lifecycle.preDestroyMethodNames, typeMetadata.lifecycle.preDestroyMethodNames); const postConstructMethodNames = getLifecycleSetUnion(extendPostConstructMethods, baseTypeClassMetadata.lifecycle.postConstructMethodNames, typeMetadata.lifecycle.postConstructMethodNames); return { postConstructMethodNames, preDestroyMethodNames, }; } //# sourceMappingURL=getExtendedLifecycle.js.map