Skip to main content
Module

x/fonction/mod.ts

A modern practical functional library
Latest
import * as fonction from "https://deno.land/x/fonction@v2.1.0-beta.4/mod.ts";

Variables

v
_

Placeholder to indicate that the argument is not explicitly set.

Adds first argument and second argument.

Returns return value if argument is function; otherwise returns the value as it is.

Returns true if both arguments are true; otherwise false.

Returns a new list containing the contents of the given list, followed by the given value.

Return an array of elements split into groups the length of size.

Safe getter for constructor.name.

Creates a function that accepts arguments of fn and either invokes fn returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining fn arguments, and so on.

Decrements its argument.

Returns the second argument if it is not null, undefined or NaN; otherwise the first argument is returned.

Divide its second argument from its first argument.

Returns true if its arguments are equivalent, false otherwise. Handles cyclical data structures.

v
F

A function that always returns false. Any passed in parameters are ignored.

Recursively flattens array.

Returns true if the first argument is greater than the second; otherwise false.

Returns true if the first argument is greater than or equal to the second; otherwise false.

Returns whether or not an object has an own property with the specified name.

Infer the head types.

Return the parameter supplied to it.

Return the onTrue or the onFalse value depending upon the result of the condition val.

Creates a function that will process either the onTrue or the onFalse function depending upon the result of the condition predicate.

Increments its argument.

Returns all but the init element of the given list or string.

v
K

K combinator. Returns a function that always returns the given value.

Returns the last element of the given list or string.

Returns true if the first argument is less than the second; otherwise false.

Returns true if the first argument is less than or equal to the second; otherwise false.

Multiplies first argument and second argument.

v
N

Returns the ! of its argument.

Abbreviation for Not Not. Returns the !! of its argument.

Returns the function as is with return value !.

Returns true if one or both of its arguments are true; otherwise false.

Performs left-to-right function composition.

Returns a new list with the given value at the front, followed by the contents of the list.

Multiplies together all the elements of a list.

Returns a function that when supplied an object returns the indicated property of that object, if it exists.

Subtracts its second argument from its first argument.

Adds together all the elements of a list.

v
T

A function that always returns true. Any passed in parameters are ignored.

Returns all but the first element of the given list or string.

Return a slice of string or array with n elements taken from the beginning.

Return a slice of string or array with n elements taken from the end.

Runs the given function with the supplied value, then returns the value.

tryCatch takes two functions, a tryer and a catcher. The returned function evaluates the tryer; if it does not throw, it simply returns the result. If the tryer does throw, the returned function evaluates the catcher function and returns its result.

Returns a new Array containing only one copy of each element in the original array. equal is used to determine equality.

Returns true if one of the arguments is truthy and the other is falsy; otherwise false.

Type Aliases

Type of any function.

Type of arity 1 function.

Alias for Empty values

Alias for Falsy values.

Infer deep flatted array.

Infer the head types.

Infer the init types.

Infer the last types.

Abbreviation for Ordinal.

Alias for Primitive values types.

Alias for Space values.

Infer the tail types.

Alias for TypedArray