improve documentation and tests

This commit is contained in:
Rene Haas
2020-09-02 15:08:27 +02:00
parent 6675b0d6db
commit 71fabc3a36
14 changed files with 164 additions and 84 deletions
@@ -51,6 +51,10 @@ export function each<T>(
*/
export const indexOf = <T = any>(arr: Array<T>, item: T, fromIndex?: number): number => arr.indexOf(item, fromIndex);
/**
* Creates a shallow-copied Array instance from an array-like or iterable object.
* @param arr The object from which the array instance shall be created.
*/
export const from = <T = any>(arr: ArrayLike<T>) => {
if (Array.from) {
return Array.from(arr);