@amoy/components
Version:
13 lines (12 loc) • 427 B
text/typescript
export function usesify(addons: Component.addon | Component.addon[]) {
return function use(target) {
const _addons = Array.isArray(addons) ? addons : [addons]
_addons.map((addon) => {
if (typeof addon === "function") {
addon(target)
} else {
throw Error(`[@amoy/components]error: addon ${addons} must be a function;`)
}
})
}
}