Re-tag function snippets
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: all
|
||||
tags: array,function,beginner
|
||||
tags: array,beginner
|
||||
---
|
||||
|
||||
Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: allEqual
|
||||
tags: array,function,beginner
|
||||
tags: array,beginner
|
||||
---
|
||||
|
||||
Check if all elements in an array are equal.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: any
|
||||
tags: array,function,beginner
|
||||
tags: array,beginner
|
||||
---
|
||||
|
||||
Returns `true` if the provided predicate function returns `true` for at least one element in a collection, `false` otherwise.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: differenceWith
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Filters out all values from an array for which the comparator function does not return `true`.
|
||||
@ -13,4 +13,4 @@ const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => co
|
||||
|
||||
```js
|
||||
differenceWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b)); // [1, 1.2]
|
||||
```
|
||||
```
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: dropRightWhile
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Removes elements from the end of an array until the passed function returns `true`. Returns the remaining elements in the array.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: dropWhile
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Removes elements in an array until the passed function returns `true`. Returns the remaining elements in the array.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: findKey
|
||||
tags: object,function,intermediate
|
||||
tags: object,intermediate
|
||||
---
|
||||
|
||||
Returns the first key that satisfies the provided testing function. Otherwise `undefined` is returned.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: findLastIndex
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Returns the index of the last element for which the provided function returns a truthy value.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: findLastKey
|
||||
tags: object,function,intermediate
|
||||
tags: object,intermediate
|
||||
---
|
||||
|
||||
Returns the last key that satisfies the provided testing function.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: forEachRight
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Executes a provided function once for each array element, starting from the array's last element.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: intersectionWith
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Returns the elements that exist in both arrays, using a provided comparator function.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: invertKeyValues
|
||||
tags: object,function,intermediate
|
||||
tags: object,intermediate
|
||||
---
|
||||
|
||||
Inverts the key-value pairs of an object, without mutating it. The corresponding inverted value of each inverted key is an array of keys responsible for generating the inverted value. If a function is supplied, it is applied to each inverted key.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: mapKeys
|
||||
tags: object,function,intermediate
|
||||
tags: object,intermediate
|
||||
---
|
||||
|
||||
Creates an object with keys generated by running the provided function for each key and the same values as the provided object.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: mapValues
|
||||
tags: object,function,intermediate
|
||||
tags: object,intermediate
|
||||
---
|
||||
|
||||
Creates an object with the same keys as the provided object and values generated by running the provided function for each value.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: matchesWith
|
||||
tags: object,type,function,intermediate
|
||||
tags: object,type,intermediate
|
||||
---
|
||||
|
||||
Compares two objects to determine if the first one contains equivalent property values to the second one, based on a provided function.
|
||||
@ -24,4 +24,4 @@ matchesWith(
|
||||
{ greeting: 'hi' },
|
||||
(oV, sV) => isGreeting(oV) && isGreeting(sV)
|
||||
); // true
|
||||
```
|
||||
```
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: none
|
||||
tags: array,function,beginner
|
||||
tags: array,beginner
|
||||
---
|
||||
|
||||
Returns `true` if the provided predicate function returns `false` for all elements in a collection, `false` otherwise.
|
||||
@ -15,4 +15,4 @@ const none = (arr, fn = Boolean) => !arr.some(fn);
|
||||
```js
|
||||
none([0, 1, 3, 0], x => x == 2); // true
|
||||
none([0, 0, 0]); // true
|
||||
```
|
||||
```
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: objectToQueryString
|
||||
tags: object,function,intermediate
|
||||
tags: object,intermediate
|
||||
---
|
||||
|
||||
Returns a query string generated from the key-value pairs of the given object.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: partition
|
||||
tags: array,object,function,intermediate
|
||||
tags: array,object,intermediate
|
||||
---
|
||||
|
||||
Groups the elements into two arrays, depending on the provided function's truthiness for each element.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: reduceSuccessive
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Applies a function against an accumulator and each element in the array (from left to right), returning an array of successively reduced values.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: reduceWhich
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Returns the minimum/maximum value of an array, after applying the provided function to set comparing rule.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: takeRightWhile
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Removes elements from the end of an array until the passed function returns `true`. Returns the removed elements.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: takeWhile
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Removes elements in an array until the passed function returns `true`. Returns the removed elements.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: unionWith
|
||||
tags: array,function,intermediate
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Returns every element that exists in any of the two arrays once, using a provided comparator function.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: unzipWith
|
||||
tags: array,function,advanced
|
||||
tags: array,advanced
|
||||
---
|
||||
|
||||
Creates an array of elements, ungrouping the elements in an array produced by [zip](#zip) and applying the provided function.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: zipWith
|
||||
tags: array,function,advanced
|
||||
tags: array,advanced
|
||||
---
|
||||
|
||||
Creates an array of elements, grouped based on the position in the original arrays and using function as the last value to specify how grouped values should be combined.
|
||||
|
||||
Reference in New Issue
Block a user