Variable: curry()
const
curry: <Parameters
,Return
>(fn
) =>Curried
<Parameters
,Return
>
Defined in: core.d.ts:57
Returns a curried version of fn
.
Type Parameters
Parameters
Parameters
extends readonly any
[]
Return
Return
Parameters
fn
(...args
) => Return
Returns
Curried
<Parameters
, Return
>
Example
import { curry } from 'lfi'
function slothLog(a, b, c) {
console.log(`${a} Sloth ${b} Sloth ${c}`)
}
const curriedSlothLog = curry(slothLog)
console.log(curriedSlothLog.name)
//=> slothLog
console.log(curriedSlothLog.length)
//=> 3
curriedSlothLog(`Hello`, `World`, `!`)
curriedSlothLog(`Hello`)(`World`, `!`)
curriedSlothLog(`Hello`, `World`)(`!`)
curriedSlothLog(`Hello`)(`World`)(`!`)
//=> Hello Sloth World Sloth !
//=> Hello Sloth World Sloth !
//=> Hello Sloth World Sloth !
//=> Hello Sloth World Sloth !
Since
v0.0.1