refactor: remove isUndefined() leftover
[e-mobility-charging-stations-simulator.git] / ui / web / src / composables / Utils.ts
CommitLineData
f568f368 1export const ifUndefined = <T>(value: T | undefined, isValue: T): T => {
194b6bf3 2 if (value === undefined) return isValue
66a7748d
JB
3 return value as T
4}
f568f368
JB
5
6// const isIterable = <T>(obj: T): boolean => {
a807045b 7// if (obj == null) {
66a7748d 8// return false
f568f368 9// }
66a7748d
JB
10// return typeof (obj as unknown as Iterable<T>)[Symbol.iterator] === 'function'
11// }
f568f368
JB
12
13// const ifNotIterableDo = <T>(obj: T, cb: () => void): void => {
66a7748d
JB
14// if (isIterable(obj) === false) cb()
15// }
f568f368 16
f568f368 17// export const compose = <T>(...fns: ((arg: T) => T)[]): ((x: T) => T) => {
66a7748d
JB
18// return (x: T) => fns.reduceRight((y, fn) => fn(y), x)
19// }