@commonly/function

Collection of functional utilities, often higher-order functions.

compose(...functions)
sourcespecification

Performs a function composition of a given functions.

Parameters

...functions: undefined[]are functions to be composed

returns: Function.Variadic  a composed function

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { compose } from "@commonly/function"

const composed = compose(String, Math.sin)
composed(7)      // -> "0.6569865987187891"

Performs a currying of an f function.

Parameters

f: Function.Variadicis a function to be curried

returns: Function.Curried  a curried version of an f function

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { curry } from "@commonly/function"

const power = curry(Math.pow)
power(2)(3)     // -> 8
debounce(debounced, [wait = 0], options)
sourcespecification

Debounces a function postponing its execution by a `wait` time every time the function is invoked.

Parameters

debounced: Function.Variadicis a function to be debounced
wait: numberis a time in milliseconds to delay the next execution of the debounced function
options: is an object which further defines the behaviour of the debounced function

returns: Debounced  a debounced function

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { debounce } from "@commonly/function"

document.body.onscroll = debounce(alert, 250)     // -> A prompt will be shown only once for every time scrolling happens
delegate(f, options)
sourcespecification

[Not documented yet]

Parameters

f: Function.Variadic
options:

returns:   

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { delegate } from "@commonly/function"
identity(value)
sourcespecification

In mathematics, an identity function, also called an identity relation or identity map or identity transformation, is a function that always returns the same value that was used as its argument. That is, for f being identity the equality f(x) = x holds for all x.

Parameters

value: TValueis any given value

returns: TValue  a passed in value

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { identity } from "@commonly/function"

identity(2)     // -> 2
identity(3)     // -> 3
identity(5)     // -> 5
negate(predicate)
sourcespecification

Negates a given predicate function, thus creating a new negated version of that function.

Parameters

predicate: Predicateis a predicate function to be negated

returns: Predicate  a negated version of a predicate function

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { negate } from "@commonly/function"

const isUnsealed = negate(Object.isSealed)
isUnsealed(window)  // -> true

Always returns an undefined no matter the arguments.

Parameters

..._: unknown[]is a variadic list of parameters which are unused anyway

returns: undefined  an undefined

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { noop } from "@commonly/function"

noop(1, 1, 2, 3, 5)     // -> undefined
partial(f, ...applied)
sourcespecification

Partially applies a list of arguments to an f function. It's similar to a Function.prototype.bind method, except it preserves this context.

Parameters

f: Function.Variadicis a function to partially apply list of arguments to
...applied: TAppliedis a list of arguments to be prepended to an f function

returns: Function.Partial  a partially applied f function

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
 import { partial } from "@commonly/function"

const isNaN = partial(Object.is, NaN)
isNaN(NaN)  // -> true
reduced(value)
sourcespecification

[Not yet documented]

Parameters

value: TValue | Reduced

returns: Reduced  

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
reducing(accumulator)
sourcespecification

Provides a reducing function based on passed accumulator, if nothing suitable is found, then it returns a scalar reducer.

Parameters

accumulator: unknown

returns: Transduced  a reducing function

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
tap(interceptor, value)
sourcespecification

Invokes a function on a given value and returns that value.

Parameters

interceptor: is a function to which the intercepted value will be provided, any value returned will be thrown away
value: TValueis a value to be intercepted

returns: TValue  an intercepted value

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { tap } from "@commonly/function"

Promise.resolve(3)
.then(tap(alert))    // -> value `x` will be shown in the alert box, it will equal to 3
.then(x => x * x)    // -> x is still equal to 3, chain is preserved
.then(tap(alert))    // -> value `x` will be shown again, this time it will equal to 9
throttle(throttled, [wait = 0])
sourcespecification

Throttles a function meaning it will be executed only once per `wait` time.

Parameters

throttled: Function.Variadicis a function to be throttled
wait: numberis a time in milliseconds to delay the next execution of the throttled function

returns: Throttled  a throttled function

Metadata

package@commonly/function
versionv0.2.0-next.54
sincev1.0.0
import { throttle } from "@commonly/function"

document.body.onscroll = throttle(alert, 1250)     // -> A prompt will be shown once every 1250 milliseconds while scrolling

@commonly/iterable

Collection of functional utilities, often higher-order functions.

chain(mapper, iterable)
sourcespecification

Applies a mapper function to each element in the iterable, producing an iterable of the same type.

Parameters

mapper: Mapperis a mapping function
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { chain } from "@commonly/iterable"

chain(x => [ x, x * x ], [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 0, 0, 1, 1, 1, 1, 2, 4, 3, 9, 5, 25, 8, 64 ]
distinct(iterable)
sourcespecification

Returns a duplicated iterable of the same type as the one given.

Parameters

iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { distinct } from "@commonly/iterable"

distinct([ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 0, 1, 2, 3, 5, 8 ]
drop(n, iterable)
sourcespecification

Returns an iterable which contains a slice of all elements of given `iterable` except for the first `n` elements.

Parameters

n: numberis a number of elements to be dropped
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { drop } from "@commonly/iterable"

drop(5, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 5, 8 ]
dropWhile(predicate, iterable)
sourcespecification

Creates a new iterable of the same type as the one given, where every value excluding the first n values are taken.

Parameters

predicate: Predicateis a predicate function
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { dropWhile } from "@commonly/iterable"

dropWhile(value => value <= 3, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 5, 8 ]
every(predicate, iterable)
sourcespecification

Applies a `predicate` function to each element in the `iterable`, returning a boolean indicating whether all of the elements passed this predicate.

Parameters

predicate: Predicateis a predicate function
iterable: Iterableis an iterable to be iterated over

returns:   an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { every } from "@commonly/iterable"

every(x => x % 2, [ 0, 1, 1, 2, 3, 5, 8 ])      // -> false
find(predicate, iterable)
sourcespecification

Applies a `predicate` function to each element in the `iterable`, returning an element passing this predicate.

Parameters

predicate: Predicateis a predicate function
iterable: Iterableis an iterable to be iterated over

returns:   an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { find } from "@commonly/iterable"

find(x => x > 2, [ 0, 1, 1, 2, 3, 5, 8 ])      // -> 3
filter(predicate, iterable)
sourcespecification

Applies a `predicate` function to each element in the `iterable`, producing an iterable of the same type with elements passing this predicate.

Parameters

predicate: Predicateis a predicate function
iterable: Iterableis an iterable to be iterated over

returns:   an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { filter } from "@commonly/iterable"

filter(x => x % 2, [ 0, 1, 1, 2, 3, 5, 8 ])      // -> [ 1, 1, 2, 3, 5 ]
flatten(iterable)
sourcespecification

Returns a flattened iterable.

Parameters

iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { flatten } from "@commonly/iterable"

flatten([ 0, [ 1 ], [ 1, 2 ], [ 3 , 5, 8 ] ])     // -> [ 0, 1, 1, 2, 3, 5, 8 ]
head(iterable)
sourcespecification

Returns a first element of `iterable`.

Parameters

iterable: Iterableis an iterable to be iterated over

returns: Iterable  a first element of an iterable

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { head } from "@commonly/iterable"

head([ 0, 1, 1, 2, 3, 5, 8 ])     // -> 0
last(iterable)
sourcespecification

Returns a last element of `iterable`.

Parameters

iterable: Iterableis an iterable to be iterated over

returns: Iterable  a last element of an iterable

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { last } from "@commonly/iterable"

last([ 0, 1, 1, 2, 3, 5, 8 ])     // -> 8
map(mapper, iterable)
sourcespecification

Applies a mapper function to each element in the iterable, producing an iterable of the same type.

Parameters

mapper: Mapperis a mapping function
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { map } from "@commonly/iterable"

map(x => x * x, [ 0, 1, 1, 2, 3, 5, 8 ])         // -> [ 0, 1, 1, 4, 9, 25, 64 ]
nth(i, iterable)
sourcespecification

Returns an `i`-nth element of `iterable`.

Parameters

i: numberis a position of an element
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an nth element of an iterable

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { nth } from "@commonly/iterable"

nth(4, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> 3
partition(n, iterable)
sourcespecification

Returns an iterable partitioned into `n`-tuples.

Parameters

n: numberis a number of elements to be put into a tuple
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { partition } from "@commonly/iterable"

partition(2, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ [ 0, 1 ], [ 1, 2 ], [ 3, 5 ], [ 8 ] ]
partitionBy(mapper, iterable)
sourcespecification

Returns an iterable partitioned into tuples.

Parameters

mapper: Mapperis a mapper function
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { partitionBy } from "@commonly/iterable"

partitionBy(number => number > 2, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ [ 0, 1, 1, 2 ], [ 3, 5, 8 ] ]
reduce(reducer, accumulator, iterable)
sourcespecification

Perform a reduction on a given iterable by applying a given reducing function to each yield value from an iterable.

Parameters

reducer: Reduceris a reducing function
accumulator: TAccumulatoris an initial value for an accumulator
iterable: Iterableis an iterable to be reduced

returns: TAccumulator  an accumulated value

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { reduce } from "@commonly/iterable"

reduce((accumulator, value) => accumulator + value, 0, [0, 1, 1, 2, 3])      // -> 7
reverse(iterable)
sourcespecification

Returns an iterable of which the order of the elements is reversed.

Parameters

iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { reverse } from "@commonly/iterable"

reverse([ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 8, 5, 3, 2, 1, 1, 0 ]
size(iterable)
sourcespecification

Returns the size of the `iterable`.

Parameters

iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { size } from "@commonly/iterable"

size([ 0, 1, 1, 2, 3, 5, 8 ])     // -> 7
slice(start, end, iterable)
sourcespecification

Returns an iterable which contains a slice of elements of given `iterable`.

Parameters

start: numberis a beginning of a slice
end: numberis an end of a slice
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { slice } from "@commonly/iterable"

slice(1, 5, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 1, 1, 2, 3, 5 ]
some(predicate, iterable)
sourcespecification

Applies a `predicate` function to each element in the `iterable`, returning a boolean indicating whether any of the elements passed this predicate.

Parameters

predicate: Predicateis a predicate function
iterable: Iterableis an iterable to be iterated over

returns:   an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { some } from "@commonly/iterable"

some(x => x % 2, [ 0, 1, 1, 2, 3, 5, 8 ])      // -> true
sort(comparator, iterable)
sourcespecification

Returns an iterable of which the order of the elements is dictated by a `comparator` function.

Parameters

comparator: Comparatoris a comparator function
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { sort } from "@commonly/iterable"

sort((a, b) => b - a, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 8, 5, 3, 2, 1, 1, 0 ]
take(n, iterable)
sourcespecification

Returns an iterable which contains a slice of only the first `n` elements of given `iterable`.

Parameters

n: numberis a number of elements to be taken
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { take } from "@commonly/iterable"

take(5, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 0, 1, 1, 2, 3 ]
takeWhile(predicate, iterable)
sourcespecification

Returns an iterable which contains a slice of only the first `n` elements of given `iterable`.

Parameters

predicate: Predicateis a predicate function
iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { takeWhile } from "@commonly/iterable"

takeWhile(value => value <= 3, [ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 0, 1, 1, 2, 3 ]
tail(iterable)
sourcespecification

Returns a tail of `iterable` as an iterable of the same type as the one given.

Parameters

iterable: Iterableis an iterable to be iterated over

returns: Iterable  an iterable of the same type as the one given

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0
import { tail } from "@commonly/iterable"

tail([ 0, 1, 1, 2, 3, 5, 8 ])     // -> [ 1, 1, 2, 3, 5, 8 ]
transduce(transducer, iterable, reducer, accumulator)
sourcespecification

[Not yet documented]

Parameters

transducer: Transducer
iterable: Iterable
reducer: Transduced
accumulator: TAccumulator

returns: TAccumulator  

Metadata

package@commonly/iterable
versionv0.2.0-next.58
sincev1.0.0

@commonly/math

Collection of mathematics utilities.

add(augend, addend)
sourcespecification

Combines two quantities using the plus operator.

Parameters

augend: numberis the first of two addends
addend: numberis the second of two addends

returns: number  a sum

Metadata

package@commonly/math
versionv0.1.1-next.8
sincev1.0.0
import { add } from "@commonly/math"

add(3, 2)   // -> 5
decrement(number)
sourcespecification

Decrements a given number by one.

Parameters

number: numberis a number to decrement by one

returns: number  a decremented number by one

Metadata

package@commonly/math
versionv0.1.1-next.8
sincev1.0.0
import { decrement } from "@commonly/math"

decrement(7)    // -> 6
divide(dividend, divisor)
sourcespecification

Divides two quantities.

Parameters

dividend: numberis a quantity that is divided by another quantity
divisor: numberis a quantity which divides a dividend

returns: number  a quotient

Metadata

package@commonly/math
versionv0.1.1-next.8
sincev1.0.0
import { divide } from "@commonly/math"

divide(3, 2)    // -> 1.5
increment(number)
sourcespecification

Increments a given number by one.

Parameters

number: numberis a number to decrement by one

returns: number  an incremented number by one

Metadata

package@commonly/math
versionv0.1.1-next.8
sincev1.0.0
import { decrement } from "@commonly/Math"

decrement(7)    // -> 8
maximum(numbers)
sourcespecification

Finds a maximum in a given list.

Parameters

numbers: number[]is a list in which we will look for a maximum

returns: number  a maximum of an xs

Metadata

package@commonly/math
versionv0.1.1-next.8
sincev1.0.0
import { maximum } from "@commonly/math"

maximum([ 0, 1, 1, 2, 3, 5, 8 ])    // -> 8
minimum(numbers)
sourcespecification

Finds a minimum in a given list.

Parameters

numbers: number[]is a list in which we will look for a maximum

returns: number  a maximum of an xs

Metadata

package@commonly/math
versionv0.1.1-next.8
sincev1.0.0
import { minimum } from "@commonly/math"

minimum([ 0, 1, 1, 2, 3, 5, 8 ])    // -> 0
multiply(multiplier, multiplicand)
sourcespecification

Multiplies two quantities.

Parameters

multiplier: numberis a quantity by which another (the multiplicand) is multiplied
multiplicand: numberis a quantity that is multiplied by another (the multiplier)

returns: number  a product

Metadata

package@commonly/math
versionv0.1.1-next.8
sincev1.0.0
import { multiply } from "@commonly/math"

multiply(3, 2)  // -> 6
subtract(minuend, subtrahend)
sourcespecification

Subtracts two quantities using the minus operator.

Parameters

minuend: numberis a quantity from which another (the subtrahend) is subtracted
subtrahend: numberis a quantity which is subtracted from another (the minuend)

returns: number  a difference

Metadata

package@commonly/math
versionv0.1.1-next.8
sincev1.0.0
import { subtract } from "@commonly/math"

subtract(3, 2)  // -> 1

@commonly/reflect

Collection of reflection utilities.

isArray(value)
sourcespecification

Check if a given value is an array.

Parameters

value: unknown | TValue[]is a value to check

returns: boolean  either true or false whether the value is an array or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isArray } from "@commonly/reflect"

isArray([])     //-> true
isArray({})      //-> false
isBoolean(value)
sourcespecification

Check if a given value is a boolean.

Parameters

value: unknown | booleanis a value to check

returns: boolean  either true or false whether the value is a boolean or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isBoolean } from "@commonly/reflect"

isBoolean(true)     //-> true
isBoolean(false)    //-> true
isBoolean(NaN)      //-> false
isError(value)
sourcespecification

Check if a given value is an Error.

Parameters

value: unknown | Erroris a value to check

returns: boolean  either true or false whether the value is an Error or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isError } from "@commonly/reflect"

isError(new Error())    //-> true
isError(TypeError())    //-> true
isError(NaN)            //-> false
isFunction(value)
sourcespecification

Check if a given value is a function.

Parameters

value: unknown | TFunctionis a value to check

returns: boolean  either true or false whether the value is a function or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isFunction } from "@commonly/reflect"

isFunction(Math.add)        //-> true
isFunction(() => void 0))   //-> true
isFunction(Math.PI)         //-> false

Check if a given value is a Map.

Parameters

value: unknown | Mapis a value to check

returns: boolean  either true or false whether the value is a Map or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isMap } from "@commonly/reflect"

isMap(new Map())     //-> true
isMap(NaN)           //-> false

Check if a given value is a Nil (either an undefined or a null).

Parameters

value: unknown | Nilis a value to check

returns: boolean  either true or false whether the value is a Nil or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isNil } from "@commonly/reflect"

isNil(undefined)   //-> true
isNil(null)        //-> true
isNil(NaN)         //-> false
isNull(value)
sourcespecification

Check if a given value is a null.

Parameters

value: unknown | nullis a value to check

returns: boolean  either true or false whether the value is a null or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isNull } from "@commonly/reflect"

isNull(null)        //-> true
isNull(undefined)   //-> false
isNumber(value)
sourcespecification

Check if a given value is a number.

Parameters

value: unknown | numberis a value to check

returns: boolean  either true or false whether the value is a number or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isNumber } from "@commonly/reflect"

isNumber(0)           //-> true
isNumber(NaN)         //-> true
isNumber(null)        //-> false
isObject(value)
sourcespecification

Check if a given value is an Object.

Parameters

value: unknown | is a value to check

returns: boolean  either true or false whether the value is an Object or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isObject } from "@commonly/reflect"

isObject(new Object())      //-> true
isObject({})                //-> true
isObject(null)              //-> false
isObject(undefined)         //-> false
isPrimitive(value)
sourcespecification

Check if a given value is a Primitive.

Parameters

value: unknown | Primitiveis a value to check

returns: boolean  either true or false whether the value is a Primitive or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isPrimitive } from "@commonly/reflect"

isPrimitive(undefined)   //-> true
isPrimitive(null)        //-> true
isPrimitive(NaN)         //-> true
isPrimitive([])          //-> false
isPromise(value)
sourcespecification

Check if a given value is a Promise.

Parameters

value: unknown | Promiseis a value to check

returns: boolean  either true or false whether the value is a Promise or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isPromise } from "@commonly/reflect"

isPromise(new Promise())         //-> true
isPromise(Promise.resolve())     //-> true
isPromise(NaN)                   //-> false
isReduced(value)
sourcespecification

[Not yet documented]

Parameters

value: TValue | Reduced

returns: boolean  

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
isRegExp(value)
sourcespecification

Check if a given value is a RegExp.

Parameters

value: unknown | RegExpis a value to check

returns: boolean  either true or false whether the value is a RegExp or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isRegExp } from "@commonly/reflect"

isRegExp(new RegExp("ab+c"))        //-> true
isRegExp(/ab+c/)                    //-> true
isRegExp(NaN)                       //-> false

Check if a given value is a Set.

Parameters

value: unknown | Setis a value to check

returns: boolean  either true or false whether the value is a Set or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isSet } from "@commonly/reflect"

isSet(new Set())     //-> true
isSet(NaN)           //-> false
isString(value)
sourcespecification

Check if a given value is a string.

Parameters

value: unknown | stringis a value to check

returns: boolean  either true or false whether the value is a string or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isString } from "@commonly/reflect"

isString("string")   //-> true
isString(null)       //-> false
isSymbol(value)
sourcespecification

Check if a given value is a symbol.

Parameters

value: unknown | symbolis a value to check

returns: boolean  either true or false whether the value is a symbol or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isSymbol } from "@commonly/reflect"

isSymbol(Symbol())      //-> true
isSymbol(NaN)           //-> false
isUndefined(value)
sourcespecification

Check if a given value is an undefined.

Parameters

value: unknown | undefinedis a value to check

returns: boolean  either true or false whether the value is an undefined or not

Metadata

package@commonly/reflect
versionv0.1.1-next.4
sincev1.0.0
import { isUndefined } from "@commonly/reflect"

isUndefined(undefined)   //-> true
isUndefined(null)        //-> false

@commonly/transducer

Collection of transducing functions.

xchain(mapper)
sourcespecification

[Not yet documented]

Parameters

mapper: Mapperis a mapping function

returns: Transducer  a transducing function

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Parameters

n: number

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xdropWhile(predicate)
sourcespecification

[Not yet documented]

Parameters

predicate: Predicate

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xevery(predicate)
sourcespecification

[Not yet documented]

Parameters

predicate: Predicate

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xfilter(predicate)
sourcespecification

[Not yet documented]

Parameters

predicate: Predicateis a predicate function

returns: Transducer  a transducer function

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xfind(predicate)
sourcespecification

[Not yet documented]

Parameters

predicate: Predicateis a predicate function

returns: Transducer  a transducer function

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Parameters

mapper: Mapperis a mapping function

returns: Transducer  a transducing function

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Parameters

i: number

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xpartition(n)
sourcespecification

[Not yet documented]

Parameters

n: number

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xpartitionBy(mapper)
sourcespecification

[Not yet documented]

Parameters

mapper: Mapper

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Parameters

n: number

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xslice(start, end)
sourcespecification

[Not yet documented]

Parameters

start: number
end: number

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xsome(predicate)
sourcespecification

[Not yet documented]

Parameters

predicate: Predicate

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xsort(comparator)
sourcespecification

[Not yet documented]

Parameters

comparator: Comparator

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

[Not yet documented]

Parameters

n: number

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0
xtakeWhile(predicate)
sourcespecification

[Not yet documented]

Parameters

predicate: Predicate

returns: Transducer  

Metadata

package@commonly/transducer
versionv0.2.0-next.55
sincev1.0.0

@commonly/type

Collection of utility types.

The Comparator type represents a comparison function, which imposes a total ordering on enumerable lists.

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

The Function type represents the function's constructor.

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

The Identity type represents a function which takes a single value as an argument and returns that value, an identity function.

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

The Mapper type represents a function which always a single value as an argument and returns a value, a mapper function.

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

The Nil type represents a union of undefined and null.

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

The Predicate type represents a function which takes a single value as an argument and returns a boolean, a predicate function.

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

The Reducer type represents a function which takes an accumulator and a value and returns an updated accumulator.

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0

[Not yet documented]

Metadata

package@commonly/type
versionv0.2.0-next.40
sincev1.0.0