Re-tag array snippets
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: CSVToJSON
|
title: CSVToJSON
|
||||||
tags: string,array,object,advanced
|
tags: string,object,advanced
|
||||||
---
|
---
|
||||||
|
|
||||||
Converts a comma-separated values (CSV) string to a 2D array of objects.
|
Converts a comma-separated values (CSV) string to a 2D array of objects.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: addWeekDays
|
title: addWeekDays
|
||||||
tags: date,array,intermediate
|
tags: date,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns a date after adding given number of business days.
|
Returns a date after adding given number of business days.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: arithmeticProgression
|
title: arithmeticProgression
|
||||||
tags: math,array,beginner
|
tags: math,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns an array of numbers in the arithmetic progression starting with the given positive integer and up to the specified limit.
|
Returns an array of numbers in the arithmetic progression starting with the given positive integer and up to the specified limit.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: averageBy
|
title: averageBy
|
||||||
tags: math,array,function,intermediate
|
tags: math,array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the average of an array, after mapping each element to a value using the provided function.
|
Returns the average of an array, after mapping each element to a value using the provided function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: bifurcateBy
|
title: bifurcateBy
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Splits values into two groups according to a predicate function, which specifies which group an element in the input collection belongs to. If the predicate function returns a truthy value, the collection element belongs to the first group; otherwise, it belongs to the second group.
|
Splits values into two groups according to a predicate function, which specifies which group an element in the input collection belongs to. If the predicate function returns a truthy value, the collection element belongs to the first group; otherwise, it belongs to the second group.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: capitalize
|
title: capitalize
|
||||||
tags: string,array,intermediate
|
tags: string,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Capitalizes the first letter of a string.
|
Capitalizes the first letter of a string.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: countWeekDaysBetween
|
title: countWeekDaysBetween
|
||||||
tags: date,array,intermediate
|
tags: date,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the weekday count between two dates.
|
Returns the weekday count between two dates.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: decapitalize
|
title: decapitalize
|
||||||
tags: string,array,intermediate
|
tags: string,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Decapitalizes the first letter of a string.
|
Decapitalizes the first letter of a string.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: differenceBy
|
title: differenceBy
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the difference between two arrays, after applying the provided function to each array element of both.
|
Returns the difference between two arrays, after applying the provided function to each array element of both.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: digitize
|
title: digitize
|
||||||
tags: math,array,beginner
|
tags: math,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Converts a number to an array of digits, removing its sign if necessary.
|
Converts a number to an array of digits, removing its sign if necessary.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: fibonacci
|
title: fibonacci
|
||||||
tags: math,array,beginner
|
tags: math,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Generates an array, containing the Fibonacci sequence, up until the nth term.
|
Generates an array, containing the Fibonacci sequence, up until the nth term.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: filterNonUniqueBy
|
title: filterNonUniqueBy
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Filters out the non-unique values in an array, based on a provided comparator function.
|
Filters out the non-unique values in an array, based on a provided comparator function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: getSiblings
|
title: getSiblings
|
||||||
tags: browser,array,intermediate
|
tags: browser,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns an array containing all the siblings of the given element.
|
Returns an array containing all the siblings of the given element.
|
||||||
|
|||||||
@ -3,7 +3,7 @@ title: head
|
|||||||
tags: array,beginner
|
tags: array,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the head of a list.
|
Returns the head of an array.
|
||||||
|
|
||||||
- Check if `arr` is truthy and has a `length` property, use `arr[0]` if possible to return the first element, otherwise return `undefined`.
|
- Check if `arr` is truthy and has a `length` property, use `arr[0]` if possible to return the first element, otherwise return `undefined`.
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ title: intersection
|
|||||||
tags: array,math,intermediate
|
tags: array,math,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns a list of elements that exist in both arrays.
|
Returns the elements that exist in both arrays.
|
||||||
|
|
||||||
- Create a `Set` from `b`, then use `Array.prototype.filter()` on `a` to only keep values contained in `b`.
|
- Create a `Set` from `b`, then use `Array.prototype.filter()` on `a` to only keep values contained in `b`.
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
title: intersectionBy
|
title: intersectionBy
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both.
|
Returns the elements that exist in both arrays, after applying the provided function to each array element of both.
|
||||||
|
|
||||||
- Create a `Set` by applying `fn` to all elements in `b`, then use `Array.prototype.filter()` on `a` to only keep elements, which produce values contained in `b` when `fn` is applied to them.
|
- Create a `Set` by applying `fn` to all elements in `b`, then use `Array.prototype.filter()` on `a` to only keep elements, which produce values contained in `b` when `fn` is applied to them.
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ title: intersectionWith
|
|||||||
tags: array,function,intermediate
|
tags: array,function,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns a list of elements that exist in both arrays, using a provided comparator function.
|
Returns the elements that exist in both arrays, using a provided comparator function.
|
||||||
|
|
||||||
- Use `Array.prototype.filter()` and `Array.prototype.findIndex()` in combination with the provided comparator to determine intersecting values.
|
- Use `Array.prototype.filter()` and `Array.prototype.findIndex()` in combination with the provided comparator to determine intersecting values.
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: isPrimitive
|
title: isPrimitive
|
||||||
tags: type,function,array,string,intermediate
|
tags: type,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns a boolean determining if the passed value is primitive or not.
|
Returns a boolean determining if the passed value is primitive or not.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: juxt
|
title: juxt
|
||||||
tags: array,function,advanced
|
tags: function,advanced
|
||||||
---
|
---
|
||||||
|
|
||||||
Takes several functions as argument and returns a function that is the juxtaposition of those functions.
|
Takes several functions as argument and returns a function that is the juxtaposition of those functions.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: mapString
|
title: mapString
|
||||||
tags: string,array,function,beginner
|
tags: string,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Creates a new string with the results of calling a provided function on every character in the calling string.
|
Creates a new string with the results of calling a provided function on every character in the calling string.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: maxBy
|
title: maxBy
|
||||||
tags: math,array,function,beginner
|
tags: math,array,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the maximum value of an array, after mapping each element to a value using the provided function.
|
Returns the maximum value of an array, after mapping each element to a value using the provided function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: midpoint
|
title: midpoint
|
||||||
tags: math,array,beginner
|
tags: math,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Calculates the midpoint between two pairs of (x,y) points.
|
Calculates the midpoint between two pairs of (x,y) points.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: minBy
|
title: minBy
|
||||||
tags: math,array,function,beginner
|
tags: math,array,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the minimum value of an array, after mapping each element to a value using the provided function.
|
Returns the minimum value of an array, after mapping each element to a value using the provided function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: normalizeLineEndings
|
title: normalizeLineEndings
|
||||||
tags: array,intermediate
|
tags: string,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Normalizes line endings in a string.
|
Normalizes line endings in a string.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: omit
|
title: omit
|
||||||
tags: object,array,intermediate
|
tags: object,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Omits the key-value pairs corresponding to the given keys from an object.
|
Omits the key-value pairs corresponding to the given keys from an object.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: omitBy
|
title: omitBy
|
||||||
tags: object,array,function,intermediate
|
tags: object,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Creates an object composed of the properties the given function returns falsy 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).
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: partitionBy
|
title: partitionBy
|
||||||
tags: array,object,function,advanced
|
tags: array,object,advanced
|
||||||
---
|
---
|
||||||
|
|
||||||
Applies `fn` to each value in `arr`, splitting it each time `fn` returns a new value.
|
Applies `fn` to each value in `arr`, splitting it each time `fn` returns a new value.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: pick
|
title: pick
|
||||||
tags: object,array,intermediate
|
tags: object,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Picks the key-value pairs corresponding to the given keys from an object.
|
Picks the key-value pairs corresponding to the given keys from an object.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: pickBy
|
title: pickBy
|
||||||
tags: object,array,function,intermediate
|
tags: object,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Creates an object composed of the properties the given function returns truthy for. The function is invoked with two arguments: (value, key).
|
Creates an object composed of the properties the given function returns truthy for. The function is invoked with two arguments: (value, key).
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: primes
|
title: primes
|
||||||
tags: math,array,intermediate
|
tags: math,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Generates primes up to a given number, using the Sieve of Eratosthenes.
|
Generates primes up to a given number, using the Sieve of Eratosthenes.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: pullBy
|
title: pullBy
|
||||||
tags: array,function,advanced
|
tags: array,advanced
|
||||||
---
|
---
|
||||||
|
|
||||||
Mutates the original array to filter out the values specified, based on a given iterator function.
|
Mutates the original array to filter out the values specified, based on a given iterator function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: readFileLines
|
title: readFileLines
|
||||||
tags: node,array,string,beginner
|
tags: node,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns an array of lines from the specified file.
|
Returns an array of lines from the specified file.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: reverseString
|
title: reverseString
|
||||||
tags: string,array,beginner
|
tags: string,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Reverses a string.
|
Reverses a string.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: sortedIndexBy
|
title: sortedIndexBy
|
||||||
tags: array,math,function,intermediate
|
tags: array,math,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the lowest index at which value should be inserted into array in order to maintain its sort order, based on a provided iterator function.
|
Returns the lowest index at which value should be inserted into array in order to maintain its sort order, based on a provided iterator function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: sortedLastIndexBy
|
title: sortedLastIndexBy
|
||||||
tags: array,math,function,intermediate
|
tags: array,math,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the highest index at which value should be inserted into array in order to maintain its sort order, based on a provided iterator function.
|
Returns the highest index at which value should be inserted into array in order to maintain its sort order, based on a provided iterator function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: sumBy
|
title: sumBy
|
||||||
tags: math,array,function,intermediate
|
tags: math,array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the sum of an array, after mapping each element to a value using the provided function.
|
Returns the sum of an array, after mapping each element to a value using the provided function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: symmetricDifferenceBy
|
title: symmetricDifferenceBy
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the symmetric difference between two arrays, after applying the provided function to each array element of both.
|
Returns the symmetric difference between two arrays, after applying the provided function to each array element of both.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: symmetricDifferenceWith
|
title: symmetricDifferenceWith
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the symmetric difference between two arrays, using a provided function as a comparator.
|
Returns the symmetric difference between two arrays, using a provided function as a comparator.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: transform
|
title: transform
|
||||||
tags: object,array,intermediate
|
tags: object,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Applies a function against an accumulator and each key in the object (from left to right).
|
Applies a function against an accumulator and each key in the object (from left to right).
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: unionBy
|
title: unionBy
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns every element that exists in any of the two arrays once, after applying the provided function to each array element of both.
|
Returns every element that exists in any of the two arrays once, after applying the provided function to each array element of both.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: uniqueElementsBy
|
title: uniqueElementsBy
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns all unique values of an array, based on a provided comparator function.
|
Returns all unique values of an array, based on a provided comparator function.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: uniqueElementsByRight
|
title: uniqueElementsByRight
|
||||||
tags: array,function,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns all unique values of an array, based on a provided comparator function, starting from the right.
|
Returns all unique values of an array, based on a provided comparator function, starting from the right.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: weightedAverage
|
title: weightedAverage
|
||||||
tags: math,array,intermediate
|
tags: math,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the weighted average of two or more numbers.
|
Returns the weighted average of two or more numbers.
|
||||||
|
|||||||
Reference in New Issue
Block a user