Ƭ AnyAsyncFn: (…args
: any
[]) => Promise
<any
>
▸ (...args
): Promise
<any
>
Represents any async function
Name | Type |
---|---|
...args |
any [] |
Promise
<any
>
Ƭ AnyFn: (…args
: any
[]) => any
▸ (...args
): any
Represents any function
Name | Type |
---|---|
...args |
any [] |
any
Ƭ Unary<A
, R
>: (a
: A
) => R
Name | Description |
---|---|
A |
the first value type |
R |
the return type |
▸ (a
): R
Represents any unary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
R
Ƭ Binary<A
, B
, R
>: (a
: A
, b
: B
) => R
Name | Description |
---|---|
A |
the first value type |
B |
the second value type |
R |
the return type |
▸ (a
, b
): R
Represents any binary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
R
Ƭ Ternary<A
, B
, C
, R
>: (a
: A
, b
: B
, c
: C
) => R
Name | Description |
---|---|
A |
the first value type |
B |
the second value type |
C |
the third value type |
R |
the return type |
▸ (a
, b
, c
): R
Represents any ternary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
c |
C |
R
Ƭ Quaternary<A
, B
, C
, D
, R
>: (a
: A
, b
: B
, c
: C
, d
: D
) => R
Name | Description |
---|---|
A |
the 1th value type |
B |
the 2th value type |
C |
the 3th value type |
D |
the 4th value type |
R |
the return type |
▸ (a
, b
, c
, d
): R
Represents any quaternary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
c |
C |
d |
D |
R
Ƭ Quinary<A
, B
, C
, D
, E
, R
>: (a
: A
, b
: B
, c
: C
, d
: D
, e
: E
) => R
Name | Description |
---|---|
A |
the 1th value type |
B |
the 2th value type |
C |
the 3th value type |
D |
the 4th value type |
E |
the 5th value type |
R |
the return type |
▸ (a
, b
, c
, d
, e
): R
Represents any quinary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
c |
C |
d |
D |
e |
E |
R
Ƭ Senary<A
, B
, C
, D
, E
, F
, R
>: (a
: A
, b
: B
, c
: C
, d
: D
, e
: E
, f
: F
) => R
Name | Description |
---|---|
A |
the 1th value type |
B |
the 2th value type |
C |
the 3th value type |
D |
the 4th value type |
E |
the 5th value type |
F |
the 6th value type |
R |
the return type |
▸ (a
, b
, c
, d
, e
, f
): R
Represents any senary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
c |
C |
d |
D |
e |
E |
f |
F |
R
Ƭ Septenary<A
, B
, C
, D
, E
, F
, G
, R
>: (a
: A
, b
: B
, c
: C
, d
: D
, e
: E
, f
: F
, g
: G
) => R
Name | Description |
---|---|
A |
the 1th value type |
B |
the 2th value type |
C |
the 3th value type |
D |
the 4th value type |
E |
the 5th value type |
F |
the 6th value type |
G |
the 7th value type |
R |
the return type |
▸ (a
, b
, c
, d
, e
, f
, g
): R
Represents any septenary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
c |
C |
d |
D |
e |
E |
f |
F |
g |
G |
R
Ƭ Octonary<A
, B
, C
, D
, E
, F
, G
, H
, R
>: (a
: A
, b
: B
, c
: C
, d
: D
, e
: E
, f
: F
, g
: G
, h
: H
) => R
Name | Description |
---|---|
A |
the 1th value type |
B |
the 2th value type |
C |
the 3th value type |
D |
the 4th value type |
E |
the 5th value type |
F |
the 6th value type |
G |
the 7th value type |
H |
the 8th value type |
R |
the return type |
▸ (a
, b
, c
, d
, e
, f
, g
, h
): R
Represents any octonary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
c |
C |
d |
D |
e |
E |
f |
F |
g |
G |
h |
H |
R
Ƭ Nonary<A
, B
, C
, D
, E
, F
, G
, H
, I
, R
>: (a
: A
, b
: B
, c
: C
, d
: D
, e
: E
, f
: F
, g
: G
, h
: H
, i
: I
) => R
Name | Description |
---|---|
A |
the 1th value type |
B |
the 2th value type |
C |
the 3th value type |
D |
the 4th value type |
E |
the 5th value type |
F |
the 6th value type |
G |
the 7th value type |
H |
the 8th value type |
I |
the 9th value type |
R |
the return type |
▸ (a
, b
, c
, d
, e
, f
, g
, h
, i
): R
Represents any nonary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
c |
C |
d |
D |
e |
E |
f |
F |
g |
G |
h |
H |
i |
I |
R
Ƭ Decenary<A
, B
, C
, D
, E
, F
, G
, H
, I
, L
, R
>: (a
: A
, b
: B
, c
: C
, d
: D
, e
: E
, f
: F
, g
: G
, h
: H
, i
: I
, l
: L
) => R
Name | Description |
---|---|
A |
the 1th value type |
B |
the 2th value type |
C |
the 3th value type |
D |
the 4th value type |
E |
the 5th value type |
F |
the 6th value type |
G |
the 7th value type |
H |
the 8th value type |
I |
the 9th value type |
L |
the 10th value type |
R |
the return type |
▸ (a
, b
, c
, d
, e
, f
, g
, h
, i
, l
): R
Represents any decenary function
Since
4.0.0
Name | Type |
---|---|
a |
A |
b |
B |
c |
C |
d |
D |
e |
E |
f |
F |
g |
G |
h |
H |
i |
I |
l |
L |
R
Ƭ T: AnyFn
Represents a generic function T with any arguments and any return value type.
▸ pass<A
>(a
): A
A function which returns it’s first argument.
Use it only as a placeholder
Example
import { Fn } from 'tiinvo'
Fn.pass(10) // 10
Fn.pass(20) // 20
Since
4.0.0
Name |
---|
A |
Name | Type |
---|---|
a |
A |
A
▸ cmp(a
, b
): ComparableResult
Compares two function signatures and names.
Example
import { Fn, Num } from 'tiinvo'
Fn.cmp(Num.add, Num.add) // 0
Fn.cmp(Num.add, Num.sub) // -1
Fn.cmp(Num.sub, Num.add) // 1
Since
4.0.0
Name | Type | Description |
---|---|---|
a |
AnyFn |
the first function |
b |
AnyFn |
the second function |
a
is less than b
a
equals to b
a
is more than b
▸ cmp(a
): Unary
<T
, ComparableResult
>
Returns a unary function which compares two function signatures and names.
Example
import { Fn, Num } from 'tiinvo'
const cmpMul = Fn.cmp(Num.mul);
cmpMul(Num.mul) // 0
cmpMul(Num.sub) // 1
cmpMul(Num.add) // -1
Since
4.0.0
Name | Type | Description |
---|---|---|
a |
AnyFn |
the second function |
the unary function which checks
b
is less than a
b
equals to a
b
is more than a
▸ eq(a
, b
): boolean
Checks if two functions are the same.
It will check that both function have:
Example
import { Fn, Num } from 'tiinvo'
Fn.eq(Num.add, Num.add) // true
Fn.eq(Num.add, Num.sub) // false
Fn.eq(Num.sub, Num.add) // false
Since
4.0.0
Name | Type | Description |
---|---|---|
a |
AnyFn |
the first function |
b |
AnyFn |
the second function |
boolean
true
if a equals to b
false
otherwiseReturns a unary function which checks if two functions are the same.
It will check that both function have:
Example
import { Fn, Num } from 'tiinvo'
const isadd = Fn.eq(Num.add)
isadd(Num.add) // true
isadd(Num.sub) // false
isadd(Num.add) // false
Since
4.0.0
Name | Type | Description |
---|---|---|
a |
AnyFn |
the first function |
the unary function which accepts a second function and returns
true
if a
equals to b
false
otherwise▸ length(a
): number
Returns a function arguments length
Example
import { Fn } from 'tiinvo'
Fn.length(Fn.cmp) // 2
Fn.length(Fn.length) // 1
Since
4.0.0
Name | Type |
---|---|
a |
AnyFn |
number
arguments count
▸ name(a
): string
Returns a function’s name
Example
import { Fn } from 'tiinvo'
Fn.name(Fn.cmp) // 'cmp'
Fn.name(Fn.name) // 'name'
Since
4.0.0
Name | Type |
---|---|
a |
AnyFn |
string
the name
▸ guard(x
): x is AnyFn
Checks if an argument x
is AnyFn
Example
import { Fn } from 'tiinvo'
Fn.guard(10) // false
Fn.guard(() => {}) // true
Since
4.0.0
Name | Type | Description |
---|---|---|
x |
unknown |
the value to guard |
x is AnyFn
true
if x
is a functionfalse
otherwise▸ map<a
, b
>(...ml
): (a
: a
) => b
[]
Maps a value a
over a list of Functors.Mappable<a, b>
and returns an array of the returning values
Example
import { Fn, Num } from 'tiinvo'
const m = Fn.map(
Num.add(1),
Num.mul(2),
Num.sub(3),
Num.pow(4),
)
m(2) // [3, 4, -1, 16]
Since
4.0.0
Name |
---|
a |
b |
Name | Type | Description |
---|---|---|
...ml |
Mappable <a , b >[] |
a list of unary functions which accept the same argument |
fn
an array of the returning values of ml
▸ (a
): b
[]
Name | Type |
---|---|
a |
a |
b
[]