UNPKG

first-npm-package-nicule

Version:

This isi first npm package

20 lines (17 loc) 718 B
import { makePropDecorator } from '../../google-decorator-factories'; import { BindDecorator } from '../bind.decorator'; import { BindActionDecorator } from './action.decorator'; export interface BindActionsDecorator { (actionNames?: Array<string>, secure?: boolean): any; new(actionNames?: Array<string>, secure?: boolean): any; } export const Actions: BindActionDecorator = makePropDecorator('BindActions', (actionNames: Array<string> = []) => { return ({ binding: { priority: 1, bind: ({ actions = [] }) => { return actions.filter(({ name }) => actionNames.includes(name)); } } as BindDecorator }) as any; });