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