koel/resources/assets/js/utils/helpers.ts

13 lines
286 B
TypeScript
Raw Normal View History

2022-04-20 09:37:22 +00:00
export const use = <T> (value: T, cb: (arg: T) => void) => {
2022-04-15 14:24:30 +00:00
if (typeof value === 'undefined' || value === null) {
return
}
cb(value)
}
2022-04-20 09:37:22 +00:00
export const arrayify = <T> (maybeArray: T | Array<T>) => ([] as Array<T>).concat(maybeArray)
// @ts-ignore
2022-04-15 14:24:30 +00:00
export const noop = () => {}