code improvements and rebuild

This commit is contained in:
Rene Haas
2021-01-14 11:44:11 +01:00
parent dc3b83ac7b
commit b1cca97c41
23 changed files with 179 additions and 133 deletions
@@ -74,9 +74,11 @@ export const from = <T = any>(arr: ArrayLike<T>) => {
return Array.from(arr);
}
const result: Array<T> = [];
each(arr, (elm) => {
push(result, elm);
});
return result;
};
@@ -92,9 +94,10 @@ export const isEmptyArray = (array: Array<any> | null | undefined) => array && a
* @param p1 The first param.
*/
export const runEach = (arr: ArrayLike<RunEachItem> | Set<RunEachItem>, p1?: unknown): void => {
const runFn = (fn: RunEachItem) => fn && fn(p1);
if (arr instanceof Set) {
arr.forEach((fn) => fn && fn(p1));
arr.forEach(runFn);
} else {
each(arr, (fn) => fn && fn(p1));
each(arr, runFn);
}
};