import * as ramda from "https://deno.land/x/ramda@v0.27.2/source/index.js";
Variables
v __ | A special placeholder value used to specify "gaps" within curried functions, allowing partial application of any combination of arguments, regardless of their positions. |
v add | Adds two values. |
Creates a new list iteration function from an existing one by adding two new parameters to its callback function: the current index, and the entire list. | |
Applies a function to the value at the given index of an array, returning a new copy of the array with the element at the given index replaced with the result of the function application. | |
v all | Returns |
Takes a list of predicates and returns a predicate that returns true for a given list of arguments if every one of the provided predicates is satisfied by those arguments. | |
Returns a function that always returns the given value. Note that for non-primitives the value returned is a reference to the original value. | |
v and | Returns |
Returns the result of applying the onSuccess function to the value inside a successfully resolved promise. This is useful for working with promises inside function compositions. | |
v any | Returns |
Takes a list of predicates and returns a predicate that returns true for a given list of arguments if at least one of the provided predicates is satisfied by those arguments. | |
v ap | ap applies a list of functions to a list of values. |
Returns a new list, composed of n-tuples of consecutive elements. If | |
Returns a new list containing the contents of the given list, followed by the given element. | |
Applies function | |
Given a spec object recursively mapping properties to functions, creates a function producing an object of the same structure, by mapping each property to the result of calling its associated function with the supplied arguments. | |
Takes a value and applies a function to it. | |
Makes an ascending comparator function out of a function that returns a value
that can be compared with | |
Makes a shallow clone of an object, setting or overriding the specified property with the given value. Note that this copies and flattens prototype properties onto the new object as well. All non-primitive properties are copied by reference. | |
Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and placing the specific value at the tail end of that path. Note that this copies and flattens prototype properties onto the new object as well. All non-primitive properties are copied by reference. | |
Wraps a function of any arity (including nullary) in a function that accepts exactly 2 parameters. Any extraneous parameters will not be passed to the supplied function. | |
v bind | Creates a function that is bound to a context.
Note: |
v both | A function which calls the two provided functions and returns the |
v call | Returns the result of calling its first argument with the remaining
arguments. This is occasionally useful as a converging function for
|
| |
Restricts a number to be within a range. | |
Creates a deep copy of the source that can be used in place of the source
object without retaining any references to it.
The source object may contain (nested) | |
Splits a list into sub-lists, based on the result of calling a key-returning function on each element, and grouping the results according to values returned. | |
Makes a comparator function out of a function that reports whether the first element is less than the second. | |
Takes a function | |
Performs right-to-left function composition using transforming function. The last function may have any arity; the remaining functions must be unary. | |
Returns the result of concatenating the given lists or strings. | |
v cond | Returns a function, |
Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. | |
Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. The arity of the function returned is specified to allow using variadic constructor functions. | |
Accepts a converging function and a list of branching functions and returns a new function. The arity of the new function is the same as the arity of the longest branching function. When invoked, this new function is applied to some arguments, and each branching function is applied to those same arguments. The results of each branching function are passed as arguments to the converging function to produce the return value. | |
Counts the elements of a list according to how many match each value of a
key generated by the supplied function. Returns an object mapping the keys
produced by | |
Returns a curried equivalent of the provided function. The curried function
has two unusual capabilities. First, its arguments needn't be provided one
at a time. If | |
Returns a curried equivalent of the provided function, with the specified
arity. The curried function has two unusual capabilities. First, its
arguments needn't be provided one at a time. If | |
v dec | Decrements its argument. |
Returns the second argument if it is not | |
Makes a descending comparator function out of a function that returns a value
that can be compared with | |
Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list. Objects and Arrays are compared in terms of value equality, not reference equality. | |
Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list. Duplication is determined according to the value returned by applying the supplied predicate to two list elements. | |
Returns a new object that does not contain a | |
Makes a shallow clone of an object, omitting the property at the given path. Note that this copies and flattens prototype properties onto the new object as well. All non-primitive properties are copied by reference. | |
Divides two numbers. Equivalent to | |
v drop | Returns all but the first |
Returns a list containing all but the last | |
Returns a new list excluding all the tailing elements of a given list which
satisfy the supplied predicate function. It passes each value from the right
to the supplied predicate function, skipping elements until the predicate
function returns a | |
Returns a new list without any consecutively repeating elements.
| |
Returns a new list without any consecutively repeating elements. Equality is determined by applying the supplied predicate to each pair of consecutive elements. The first element in a series of equal elements will be preserved. | |
Returns a new list excluding the leading elements of a given list which
satisfy the supplied predicate function. It passes each value to the supplied
predicate function, skipping elements while the predicate function returns
| |
A function wrapping calls to the two functions in an | |
Returns the empty value of its argument's type. Ramda defines the empty
value of Array ( | |
Checks if a list ends with the provided sublist. | |
v eqBy | Takes a function and two values in its domain and returns |
Reports whether two objects have the same value, in | |
Returns | |
Creates a new object by recursively evolving a shallow copy of | |
v F | A function that always returns |
Takes a predicate and a | |
v find | Returns the first element of the list which matches the predicate, or
|
Returns the index of the first element of the list which matches the
predicate, or | |
Returns the last element of the list which matches the predicate, or
| |
Returns the index of the last element of the list which matches the
predicate, or | |
Returns a new list by pulling every item out of it (and all its sub-arrays) and putting them in a new array, depth-first. | |
v flip | Returns a new function much like the supplied one, except that the first two arguments' order is reversed. |
Iterate over an input | |
Iterate over an input | |
Creates a new object from a list key-value pairs. If a key appears in multiple pairs, the rightmost pair is included in the object. | |
Splits a list into sub-lists stored in an object, based on the result of calling a key-returning function on each element, and grouping the results according to values returned. | |
Takes a list and returns a list of lists where each sublist's elements are all satisfied pairwise comparison according to the provided function. Only adjacent elements are passed to the comparison function. | |
v gt | Returns |
v gte | Returns |
v has | Returns whether or not an object has an own property with the specified name |
Returns whether or not an object or its prototype chain has a property with the specified name | |
Returns whether or not a path exists in an object. Only the object's own properties are checked. | |
v head | Returns the first element of the given list or string. In some libraries
this function is named |
Returns true if its arguments are identical, false otherwise. Values are
identical if they reference the same memory. | |
A function that does nothing but return the parameter supplied to it. Good as a default or placeholder function. | |
Creates a function that will process either the | |
v inc | Increments its argument. |
Returns | |
Given a function that generates a key, turns a list of objects into an object indexing the objects by the given key. Note that if multiple objects generate the same value for the indexing key only the last value will be included in the generated object. | |
Returns the position of the first occurrence of an item in an array, or -1
if the item is not included in the array. | |
v init | Returns all but the last element of the given list or string. |
Takes a predicate | |
Inserts the supplied element into the list, at the specified | |
Inserts the sub-list into the list, at the specified | |
Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists. | |
Creates a new list with the separator interposed between elements. | |
v into | Transforms the items of the list with the transducer and appends the transformed items to the accumulator using an appropriate iterator function based on the accumulator type. |
Same as | |
Returns a new object with the keys of the given object as values, and the values of the given object, which are coerced to strings, as keys. Note that the last key found is preferred when handling the same value. | |
Turns a named method with a specified arity into a function that can be called directly supplied with arguments and a target object. | |
v is | See if an object ( |
Returns | |
Checks if the input value is | |
v join | Returns a string made by inserting the |
v juxt | juxt applies a list of functions to a list of values. |
v keys | Returns a list containing the names of all the enumerable own properties of the supplied object. Note that the order of the output array is not guaranteed to be consistent across different JS platforms. |
Returns a list containing the names of all the properties of the supplied object, including prototype properties. Note that the order of the output array is not guaranteed to be consistent across different JS platforms. | |
v last | Returns the last element of the given list or string. |
Returns the position of the last occurrence of an item in an array, or -1 if
the item is not included in the array. | |
Returns the number of elements in the array by returning | |
v lens | Returns a lens for the given getter and setter functions. The getter "gets" the value of the focus; the setter "sets" the value of the focus. The setter should not mutate the data structure. |
Returns a lens whose focus is the specified index. | |
Returns a lens whose focus is the specified path. | |
Returns a lens whose focus is the specified property. | |
v lift | "lifts" a function of arity > 1 so that it may "map over" a list, Function or other object that satisfies the FantasyLand Apply spec. |
"lifts" a function to be the specified arity, so that it may "map over" that many lists, Functions or other objects that satisfy the FantasyLand Apply spec. | |
v lt | Returns |
v lte | Returns |
v map | Takes a function and a functor, applies the function to each of the functor's values, and returns a functor of the same shape. |
The | |
The | |
Tests a regular expression against a String. Note that this function will
return an empty array when there are no matches. This differs from
| |
| |
v max | Returns the larger of its two arguments. |
Takes a function and two values, and returns whichever value produces the larger result when passed to the provided function. | |
v mean | Returns the mean of the given list of numbers. |
Returns the median of the given list of numbers. | |
Creates a new function that, when invoked, caches the result of calling | |
Creates one new object with the own properties from a list of objects. If a key exists in more than one object, the value from the last object it exists in will be used. | |
Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects:
| |
Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects:
| |
Creates a new object with the own properties of the two provided objects. If a key exists in both objects:
| |
Creates a new object with the own properties of the two provided objects. If a key exists in both objects:
| |
Create a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects, the value from the first object will be used. | |
Create a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects, the value from the second object will be used. | |
Creates a new object with the own properties of the two provided objects. If a key exists in both objects, the provided function is applied to the values associated with the key in each object, with the result being used as the value associated with the key in the returned object. | |
Creates a new object with the own properties of the two provided objects. If a key exists in both objects, the provided function is applied to the key and the values associated with the key in each object, with the result being used as the value associated with the key in the returned object. | |
v min | Returns the smaller of its two arguments. |
Takes a function and two values, and returns whichever value produces the smaller result when passed to the provided function. | |
Creates a copy of the passed object by applying an | |
Creates a shallow clone of the passed object by applying an | |
Divides the first parameter by the second and returns the remainder. Note
that this function preserves the JavaScript-style behavior for modulo. For
mathematical modulo see | |
v move | Move an item, at index |
Multiplies two numbers. Equivalent to | |
v nAry | Wraps a function of any arity (including nullary) in a function that accepts
exactly |
Negates its argument. | |
v none | Returns |
v not | A function that returns the |
v nth | Returns the nth element of the given list or string. If n is negative the element at index length + n is returned. |
Returns a function which returns its nth argument. | |
v o |
|
Creates an object containing a single key:value pair. | |
v of | Returns a singleton array containing the value provided. |
v omit | Returns a partial copy of an object omitting the keys specified. |
v on | Takes a binary function |
v once | Accepts a function |
v or | Returns |
Returns the result of applying the onFailure function to the value inside a failed promise. This is useful for handling rejected promises inside function compositions. | |
v over | Returns the result of "setting" the portion of the given data structure focused by the given lens to the result of applying the given function to the focused value. |
v pair | Takes two arguments, |
Takes a function | |
Takes a function | |
Takes a function | |
Takes a predicate and a list or other | |
v path | Retrieve the value at a given path. |
Determines whether a nested path on an object has a specific value, in
| |
If the given, non-null object has a value at the given path, returns the value at that path. Otherwise returns the provided default value. | |
Retrieves the values at given paths of an object. | |
Returns | |
v pick | Returns a partial copy of an object containing only the keys specified. If the key does not exist, the property is ignored. |
Similar to | |
Returns a partial copy of an object containing only the keys that satisfy the supplied predicate. | |
Performs left-to-right function composition using transforming function. The first function may have any arity; the remaining functions must be unary. | |
Returns a new list by plucking the same named property off all objects in the list supplied. | |
Returns a new list with the given element at the front, followed by the contents of the list. | |
Multiplies together all the elements of a list. | |
Reasonable analog to SQL | |
Takes two functions as pre- and post- processors respectively for a third function,
i.e. | |
v prop | Returns a function that when supplied an object returns the indicated property of that object, if it exists. |
Returns | |
Return the specified property of the given non-null object if the property
is present and it's value is not | |
Acts as multiple | |
Returns | |
Returns a list of numbers from | |
Returns a single item by iterating through the list, successively calling the iterator function and passing it an accumulator value and the current value from the array, and then passing the result to the next call. | |
Groups the elements of the list according to the result of calling
the String-returning function | |
Returns a value wrapped to indicate that it is the final value of the reduce and transduce functions. The returned value should be considered a black box: the internal structure is not guaranteed to be stable. | |
Returns a single item by iterating through the list, successively calling the iterator function and passing it an accumulator value and the current value from the array, and then passing the result to the next call. | |
Like | |
The complement of | |
Removes the sub-list of | |
Returns a fixed list of size | |
Replace a substring or regex match in a string with a replacement. | |
Returns a new list or string with the elements or characters in reverse order. | |
v scan | Scan is similar to |
Transforms a Traversable of Applicative into an Applicative of Traversable. | |
v set | Returns the result of "setting" the portion of the given data structure focused by the given lens to the given value. |
Returns the elements of the given list or string (or object with a | |
v sort | Returns a copy of the list, sorted according to the comparator function, which should accept two values at a time and return a negative number if the first value is smaller, a positive number if it's larger, and zero if they are equal. Please note that this is a copy of the list. It does not modify the original. |
Sorts the list according to the supplied function. | |
Sorts a list according to a list of comparators. | |
Splits a string into an array of strings based on the given separator. | |
Splits a given list or string at a given index. | |
Splits a collection into slices of the specified length. | |
Takes a list and a predicate and returns a pair of lists with the following properties: | |
Splits an array into slices on every occurrence of a value. | |
Checks if a list starts with the provided sublist. | |
Subtracts its second argument from its first argument. | |
v sum | Adds together all the elements of a list. |
Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both. | |
Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both. Duplication is determined according to the value returned by applying the supplied predicate to two list elements. | |
v T | A function that always returns |
v tail | Returns all but the first element of the given list or string (or object
with a |
v take | Returns the first |
Returns a new list containing the last | |
Returns a new list containing the last | |
Returns a new list containing the first | |
v tap | Runs the given function with the supplied object, then returns the object. |
v test | Determines whether a given string matches a given regular expression. |
Creates a thunk out of a function. A thunk delays a calculation until its result is needed, providing lazy evaluation of arguments. | |
Calls an input function | |
The lower case version of a string. | |
Converts an object into an array of key, value arrays. Only the object's own properties are used. Note that the order of the output array is not guaranteed to be consistent across different JS platforms. | |
Converts an object into an array of key, value arrays. The object's own properties and prototype properties are used. Note that the order of the output array is not guaranteed to be consistent across different JS platforms. | |
Returns the string representation of the given value. | |
The upper case version of a string. | |
Initializes a transducer using supplied iterator function. Returns a single item by iterating through the list, successively calling the transformed iterator function and passing it an accumulator value and the current value from the array, and then passing the result to the next call. | |
Transposes the rows and columns of a 2D list.
When passed a list of | |
Maps an Applicative-returning
function over a Traversable,
then uses | |
v trim | Removes (strips) whitespace from both ends of the string. |
| |
v type | Gives a single-word string description of the (native) type of a value, returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not attempt to distinguish user Object types any further, reporting them all as 'Object'. |
Takes a function | |
Wraps a function of any arity (including nullary) in a function that accepts exactly 1 parameter. Any extraneous parameters will not be passed to the supplied function. | |
Returns a function of arity | |
Builds a list from a seed value. Accepts an iterator function, which returns either false to stop iteration or an array of length 2 containing the value to add to the resulting list and the seed to be used in the next call to the iterator function. | |
Combines two lists into a set (i.e. no duplicates) composed of the elements of each list. | |
Combines two lists into a set (i.e. no duplicates) composed of the elements of each list. Duplication is determined according to the value returned by applying the supplied predicate to two list elements. If an element exists in both lists, the first element from the first list will be used. | |
v uniq | Returns a new list containing only one copy of each element in the original
list. |
Returns a new list containing only one copy of each element in the original
list, based upon the value returned by applying the supplied function to
each list element. Prefers the first item if the supplied function produces
the same value on two items. | |
Returns a new list containing only one copy of each element in the original list, based upon the value returned by applying the supplied predicate to two list elements. Prefers the first item if two items compare equal based on the predicate. | |
Tests the final argument by passing it to the given predicate function. If
the predicate is not satisfied, the function will return the result of
calling the | |
Shorthand for | |
Takes a predicate, a transformation function, and an initial value, and returns a value of the same type as the initial value. It does so by applying the transformation until the predicate is satisfied, at which point it returns the satisfactory value. | |
Returns a new copy of the array with the element at the provided index replaced with the given value. | |
Accepts a function | |
Returns a list of all the enumerable own properties of the supplied object. Note that the order of the output array is not guaranteed across different JS platforms. | |
Returns a list of all the properties, including prototype properties, of the supplied object. Note that the order of the output array is not guaranteed to be consistent across different JS platforms. | |
v view | Returns a "view" of the given data structure, determined by the given lens. The lens's focus determines which portion of the data structure is visible. |
v when | Tests the final argument by passing it to the given predicate function. If
the predicate is satisfied, the function will return the result of calling
the |
Takes a spec object and a test object; returns true if the test satisfies
the spec. Each of the spec's own properties must be a predicate function.
Each predicate is applied to the value of the corresponding property of the
test object. | |
Takes a spec object and a test object; each of the spec's own properties must be a predicate function.
Each predicate is applied to the value of the corresponding property of the
test object. | |
Takes a spec object and a test object; returns true if the test satisfies
the spec, false otherwise. An object satisfies the spec if, for each of the
spec's own properties, accessing that property of the object gives the same
value (in | |
Returns a new list without values in the first argument.
| |
v xor | Exclusive disjunction logical operation.
Returns |
Creates a new list out of the two supplied by creating each possible pair from the lists. | |
v zip | Creates a new list out of the two supplied by pairing up equally-positioned
items from both lists. The returned list is truncated to the length of the
shorter of the two input lists.
Note: |
Creates a new object out of a list of keys and a list of values.
Key/value pairing is truncated to the length of the shorter of the two lists.
Note: | |
Creates a new list out of the two supplied by applying the function to each equally-positioned pair in the lists. The returned list is truncated to the length of the shorter of the two input lists. |