Files
Umbraco-CMS/src/Umbraco.Web.UI.Client/libs/extensions-api/has-init-export.function.ts
Niels Lyngsø c65d0506e1 lint and style
2023-03-16 21:13:58 +01:00

9 lines
312 B
TypeScript

import type { UmbEntrypointModule } from './umb-lifecycle.interface';
/**
* Validate if an ESModule exports a known init function called 'onInit'
*/
export function hasInitExport(obj: unknown): obj is Pick<UmbEntrypointModule, 'onInit'> {
return obj !== null && typeof obj === 'object' && 'onInit' in obj;
}