Ƭ AsChain<f
, g
>: { [k in keyof f]: Function }
Name | Type |
---|---|
f |
extends [FuncType , …FuncType[]] |
g |
extends FuncType [] = Tail <f > |
Ƭ AsAsyncChain<f
, g
>: { [k in keyof f]: Function }
Name | Type |
---|---|
f |
extends [FuncType , …FuncType[]] |
g |
extends FuncType [] = Tail <f > |
Ƭ ArgType<F
, Else
>: F
extends (arg
: infer A) => any
? A
: Else
Name | Type |
---|---|
F |
F |
Else |
never |
Ƭ FuncType: (arg
: any
) => any
▸ (arg
): any
Name | Type |
---|---|
arg |
any |
any
Ƭ LastIndexOf<a
>: (…x
: a
) => void
extends (y
: any
, …z
: infer b) => void
? b
["length"
] : never
Name | Type |
---|---|
a |
extends any [] |
Ƭ Lookup<t
, k
, el
>: k
extends keyof t
? t
[k
] : el
Name | Type |
---|---|
t |
t |
k |
extends keyof any |
el |
never |
Ƭ Tail<a
>: (…t
: a
) => void
extends (x
: any
, …u
: infer b) => void
? b
: never
Name | Type |
---|---|
a |
extends any [] |
Ƭ Pipe: <f>(…f
: f
& AsChain
<f
>) => f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: infer U) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
▸ <f
>(...f
): f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: infer U) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
Name | Type |
---|---|
f |
extends [(arg : any ) => any | () => any , …Function[]] |
Name | Type |
---|---|
...f |
f & AsChain <f > |
f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: infer U) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
Ƭ PipeAsync: <f>(…f
: f
& AsAsyncChain
<f
>) => f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: infer U) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
▸ <f
>(...f
): f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: infer U) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
Name | Type |
---|---|
f |
extends [(arg : any ) => Promise <any > | () => Promise <any >, …Function[]] |
Name | Type |
---|---|
...f |
f & AsAsyncChain <f > |
f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: infer U) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
▸ async<f
>(...f
): f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: U
) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
Same as the sync version, but handles promises.
Since
4.0.0
Name | Type |
---|---|
f |
extends [(arg : any ) => Promise <any > | () => Promise <any >, …Function[]] |
Name | Type |
---|---|
...f |
f & AsAsyncChain <f , Tail <f >> |
f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: U
) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
▸ sync<f
>(...f
): f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: U
) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never
Creates a pipeline of synchronous functions
Example
import { Num, Pipe } from 'tiinvo'
const vat = Pipe.sync(Num.div(100), Num.mul(22));
vat(100) // 22
vat(150) // 33
vat(200) // 44
Since
4.0.0
Name | Type |
---|---|
f |
extends [(arg : any ) => any , …Function[]] |
Name | Type |
---|---|
...f |
f & AsChain <f , Tail <f >> |
f
[0
] extends () => any
? () => ReturnType
<f
[LastIndexOf
<f
>]> : f
[0
] extends (arg
: U
) => any
? (arg
: U
) => ReturnType
<f
[LastIndexOf
<f
>]> : never