UNPKG

@snipsonian/core

Version:

Core/base reusable javascript code snippets

17 lines (14 loc) 537 B
// eslint-disable-next-line @typescript-eslint/no-explicit-any export type TDecorator = (target: any) => any; interface IDecorateTargetWith<Target> { with: (...decorators: TDecorator[]) => Target; } // eslint-disable-next-line @typescript-eslint/no-explicit-any export default function decorate<Target = any>(target: Target): IDecorateTargetWith<Target> { return { with: (...decorators: TDecorator[]) => { decorators.forEach((decorator) => decorator(target)); return target; }, }; }