diff --git a/docs/index.html b/docs/index.html index 06a3a4995..119e2b7bb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,9 +24,10 @@
@@ -38,10 +39,9 @@Maps the values of an array to an object using a function, where the key-value pairs consist of the original value as the key and the mapped value.
Use an anonymous inner function scope to declare an undefined memory space, using closures to store a return value. Use a new Array to stor the array with a map of the function over its data set and a comma operator to return a second step, without needing to move from one context to another (due to closures and order of operations).
const mapObject = (arr, fn) =>
+const mapObject = (arr, fn) =>
(a => (a = [arr, arr.map(fn)], a[0].reduce( (acc,val,ind) => (acc[val] = a[1][ind], acc), {}) )) ( );
/*
const squareIt = arr => mapObject(arr, a => a*a)
@@ -386,7 +386,7 @@ Use Array.push() to keep track of pulled values
let removed = [];
let pulled = arr.map((v, i) => pullArr.includes(i) ? removed.push(v) : v)
.filter((v, i) => !pullArr.includes(i))
- arr.length = 0;
+ arr.length = 0;
pulled.forEach(v => arr.push(v));
return removed;
}
@@ -403,7 +403,7 @@ Use Array.push() to keep track of pulled values
Use Array.length = 0 to mutate the passed in array by resetting it's length to zero and Array.push() to re-populate it with only the pulled values.
Use Array.push() to keep track of pulled values
const pullAtValue = (arr, pullArr) => {
- let removed = [],
+ let removed = [],
pushToRemove = arr.forEach((v, i) => pullArr.includes(v) ? removed.push(v) : v),
mutateTo = arr.filter((v, i) => !pullArr.includes(v));
arr.length = 0;
@@ -1183,4 +1183,3 @@ Use Number() to check if the coercion holds.