Changing instances of the word falsey to falsy for consistency sake, and especially as there is the array FilterFalsy function that is spelled without an e.
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
### compact
|
||||
|
||||
Removes falsey values from an array.
|
||||
Removes falsy values from an array.
|
||||
|
||||
Use `Array.prototype.filter()` to filter out falsey values (`false`, `null`, `0`, `""`, `undefined`, and `NaN`).
|
||||
Use `Array.prototype.filter()` to filter out falsy values (`false`, `null`, `0`, `""`, `undefined`, and `NaN`).
|
||||
|
||||
```js
|
||||
const compact = arr => arr.filter(Boolean);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
Returns the last element for which the provided function returns a truthy value.
|
||||
|
||||
Use `Array.prototype.filter()` to remove elements for which `fn` returns falsey values, `Array.prototype.pop()` to get the last one.
|
||||
Use `Array.prototype.filter()` to remove elements for which `fn` returns falsy values, `Array.prototype.pop()` to get the last one.
|
||||
|
||||
```js
|
||||
const findLast = (arr, fn) => arr.filter(fn).pop();
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
Returns the index of the last element for which the provided function returns a truthy value.
|
||||
|
||||
Use `Array.prototype.map()` to map each element to an array with its index and value.
|
||||
Use `Array.prototype.filter()` to remove elements for which `fn` returns falsey values, `Array.prototype.pop()` to get the last one.
|
||||
Use `Array.prototype.filter()` to remove elements for which `fn` returns falsy values, `Array.prototype.pop()` to get the last one.
|
||||
|
||||
```js
|
||||
const findLastIndex = (arr, fn) =>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
### omitBy
|
||||
|
||||
Creates an object composed of the properties the given function returns falsey for. The function is invoked with two arguments: (value, key).
|
||||
Creates an object composed of the properties the given function returns falsy for. The function is invoked with two arguments: (value, key).
|
||||
|
||||
Use `Object.keys(obj)` and `Array.prototype.filter()`to remove the keys for which `fn` returns a truthy value.
|
||||
Use `Array.prototype.reduce()` to convert the filtered keys back to an object with the corresponding key-value pairs.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
Creates an object composed of the properties the given function returns truthy for. The function is invoked with two arguments: (value, key).
|
||||
|
||||
Use `Object.keys(obj)` and `Array.prototype.filter()`to remove the keys for which `fn` returns a falsey value.
|
||||
Use `Object.keys(obj)` and `Array.prototype.filter()`to remove the keys for which `fn` returns a falsy value.
|
||||
Use `Array.prototype.reduce()` to convert the filtered keys back to an object with the corresponding key-value pairs.
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user