koel/resources/assets/js/utils/helpers.ts
2022-04-20 11:37:22 +02:00

12 lines
286 B
TypeScript

export const use = <T> (value: T, cb: (arg: T) => void) => {
if (typeof value === 'undefined' || value === null) {
return
}
cb(value)
}
export const arrayify = <T> (maybeArray: T | Array<T>) => ([] as Array<T>).concat(maybeArray)
// @ts-ignore
export const noop = () => {}