#
Module: "urx/src/utils"Utils includes
- a handful of functional utilities inspired by or taken from the Ramda library;
- TypeScript crutches - the tup function.
Use these for your convenience - they are here so that urx is zero-dependency package.
#
Index#
Functions#
Functions#
alwaysâ–¸ always<T>(value
: T): (Anonymous function)
Defined in urx/src/utils.ts:77
returns a function which when called always returns the passed value
#
Type parameters:Name |
---|
T |
#
Parameters:Name | Type |
---|---|
value | T |
Returns: (Anonymous function)
#
callâ–¸ call(proc
: Proc): void
Defined in urx/src/utils.ts:70
Calls the passed function.
#
Parameters:Name | Type |
---|---|
proc | Proc |
Returns: void
#
composeâ–¸ compose<I, A, R>(a
: (arg: A) => R, b
: (arg: I) => A): function
Defined in urx/src/utils.ts:19
Performs left to right composition of two functions.
#
Type parameters:Name |
---|
I |
A |
R |
#
Parameters:Name | Type |
---|---|
a | (arg: A) => R |
b | (arg: I) => A |
Returns: function
#
curry1to0â–¸ curry1to0<T, R>(proc
: (arg: T) => R, arg
: T): function
Defined in urx/src/utils.ts:40
Takes a 1 argument function and returns a function which when called, executes it with the provided argument.
#
Type parameters:Name |
---|
T |
R |
#
Parameters:Name | Type |
---|---|
proc | (arg: T) => R |
arg | T |
Returns: function
#
curry2to1â–¸ curry2to1<T, K, R>(proc
: (arg1: T, arg2: K) => R, arg1
: T): function
Defined in urx/src/utils.ts:33
Takes a 2 argument function and partially applies the first argument.
#
Type parameters:Name |
---|
T |
K |
R |
#
Parameters:Name | Type |
---|---|
proc | (arg1: T, arg2: K) => R |
arg1 | T |
Returns: function
#
joinProcâ–¸ joinProc(...procs
: Proc[]): (Anonymous function)
Defined in urx/src/utils.ts:85
returns a function which calls all passed functions in the passed order. joinProc does not pass arguments or collect return values.
#
Parameters:Name | Type |
---|---|
...procs | Proc[] |
Returns: (Anonymous function)
#
noopâ–¸ noop(): void
Defined in urx/src/utils.ts:91
Returns: void
#
propâ–¸ prop(property
: string): (Anonymous function)
Defined in urx/src/utils.ts:47
Returns a function which extracts the property from from the passed object.
#
Parameters:Name | Type |
---|---|
property | string |
Returns: (Anonymous function)
#
tapâ–¸ tap<T>(arg
: T, proc
: (arg: T) => any): T
Defined in urx/src/utils.ts:54
Calls callback with the first argument, and returns it.
#
Type parameters:Name |
---|
T |
#
Parameters:Name | Type |
---|---|
arg | T |
proc | (arg: T) => any |
Returns: T
#
thrushâ–¸ thrush<I, K>(arg
: I, proc
: (arg: I) => K): K
Defined in urx/src/utils.ts:26
Takes a value and applies a function to it.
#
Type parameters:Name |
---|
I |
K |
#
Parameters:Name | Type |
---|---|
arg | I |
proc | (arg: I) => K |
Returns: K
#
tupâ–¸ tup<T>(...args
: T): T
Defined in urx/src/utils.ts:63
Utility function to help typescript figure out that what we pass is a tuple and not a generic array. Taken from (this StackOverflow tread)[https://stackoverflow.com/questions/49729550/implicitly-create-a-tuple-in-typescript/52445008#52445008]
#
Type parameters:Name | Type |
---|---|
T | Array<any> |
#
Parameters:Name | Type |
---|---|
...args | T |
Returns: T