import { forward } from "https://deno.land/x/froebel@v0.18.0/mod.ts";
Given a function and its nth..last arguments, return a function accepting arguments 0..n-1.
Examples
Example 1
Example 1
const divide = (dividend: number, divisor: number) => dividend / divisor
// (dividend: number) => number
const divideBy2 = forward(divide, 2)
// prints: 0.5
console.log(divideBy2(1))
Example 2
Example 2
const fetchUrl = async (protocol: string, domain: string, path: string) =>
await fetch(`${protocol}://${domain}/${path}`)
const fetchRepo = forward(fetchUrl, 'github.com', 'MathisBullinger/froebel')
const viaHTTPS = await fetchRepo('https')