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