mirror of
https://github.com/koel/koel
synced 2024-12-19 17:13:09 +00:00
15 lines
395 B
TypeScript
15 lines
395 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 = () => {
|
|
}
|
|
|
|
export const limitBy = <T> (arr: T[], n: number, offset: number = 0): T[] => arr.slice(offset, offset + n)
|