diff --git a/README.md b/README.md
index 57a12fcd5..48e178ea4 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,7 @@
* [`pullAtIndex`](#pullatindex)
* [`pullAtValue`](#pullatvalue)
* [`quickSort`](#quicksort)
+* [`reducedFilter`](#reducedfilter)
* [`remove`](#remove)
* [`sample`](#sample)
* [`sampleSize`](#samplesize)
@@ -271,15 +272,6 @@
-### _Uncategorized_
-
-
-View contents
-
-* [`reducedFilter`](#reducedfilter)
-
-
-
---
## 🔌 Adapter
@@ -1192,6 +1184,48 @@ quickSort([4, 1, 3, 2], true); // [4,3,2,1]
[⬆ Back to top](#table-of-contents)
+### reducedFilter
+
+Filter an array of objects based on a condition while also filtering out unspecified keys.
+
+Use `Array.filter()` to filter the array based on the predicate `fn` so that it returns the objects for which the condition returned a truthy value.
+On the filtered array, use `Array.map()` to return the new object using `Array.reduce()` to filter out the keys which were not supplied as the `keys` argument.
+
+```js
+const reducedFilter = (data, keys, fn) =>
+ data.filter(fn).map(el =>
+ keys.reduce((acc, key) => {
+ acc[key] = el[key];
+ return acc;
+ }, {})
+ );
+```
+
+
+Examples
+
+```js
+const data = [
+ {
+ id: 1,
+ name: 'john',
+ age: 24
+ },
+ {
+ id: 2,
+ name: 'mike',
+ age: 50
+ }
+];
+
+reducedFilter(data, ['id', 'name'], item => item.age > 24); // [{ id: 2, name: 'mike'}]
+```
+
+
+
+ [⬆ Back to top](#table-of-contents)
+
+
### remove
Removes elements from an array for which the given function returns `false`.
@@ -4249,13 +4283,12 @@ Checks if the provided argument is array-like (i.e. is iterable).
Use the spread operator (`...`) to check if the provided argument is iterable inside a `try... catch` block and the comma operator (`,`) to return the appropriate value.
```js
-
-
-
-
-const isArrayLike = val =>
- try {return [...val], true; }
- catch (e) { return false; }
+const isArrayLike = val => {
+ try {
+ return [...val], true;
+ } catch (e) {
+ return false;
+ }
};
```
@@ -4713,45 +4746,6 @@ yesNo('Foo', true); // true
[⬆ Back to top](#table-of-contents)
----
- ## _Uncategorized_
-
-### reducedFilter
-
-Filter an array of objects based on a condition while also filtering out unspecified keys.
-
-Use `Array.filter()` to filter the array based on the predicate `fn` so that it returns the objects for which the condition returned a truthy value.
-On the filtered array, use `Array.map()` to return the new object using `Array.reduce()` to filter out the keys which were not supplied as the `keys` argument.
-
-```js
-const reducedFilter = (data, keys, fn) =>
- data.filter(fn).map(el =>
- keys.reduce((acc, key) => {
- acc[key] = el[key];
- return acc;
- }, {})
- );
-```
-
-```js
-const data = [
- {
- id: 1,
- name: 'john',
- age: 24
- },
- {
- id: 2,
- name: 'mike',
- age: 50
- }
-];
-
-reducedFilter(data, ['id', 'name'], item => item.age > 24); // [{ id: 2, name: 'mike'}]
-```
-
- [⬆ back to top](#table-of-contents)
-
## Collaborators
diff --git a/docs/index.html b/docs/index.html
index b72f07002..3d297e8b7 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -59,7 +59,7 @@
wrapper.appendChild(box);
box.appendChild(el);
});
- }
30 seconds of code Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.
Adapter
call
Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
Use a closure to call a stored key with stored arguments.
Filter an array of objects based on a condition while also filtering out unspecified keys.
Use Array.filter() to filter the array based on the predicate fn so that it returns the objects for which the condition returned a truthy value. On the filtered array, use Array.map() to return the new object using Array.reduce() to filter out the keys which were not supplied as the keys argument.
Removes elements from an array for which the given function returns false.
Use Array.filter() to find array elements that return truthy values and Array.reduce() to remove elements using Array.splice(). The func is invoked with three arguments (value, index, array).
Use Array.isArray() to check if a value is classified as an array.
const isArray = val => !!val && Array.isArray(val);
isArray(null); // false
isArray([1]); // true
-
isArrayLike
Checks if the provided argument is array-like (i.e. is iterable).
Use the spread operator (...) to check if the provided argument is iterable inside a try... catch block and the comma operator (,) to return the appropriate value.
Checks if the provided argument is array-like (i.e. is iterable).
Use the spread operator (...) to check if the provided argument is iterable inside a try... catch block and the comma operator (,) to return the appropriate value.
Filter an array of objects based on a condition while also filtering out unspecified keys.
Use Array.filter() to filter the array based on the predicate fn so that it returns the objects for which the condition returned a truthy value. On the filtered array, use Array.map() to return the new object using Array.reduce() to filter out the keys which were not supplied as the keys argument.