deno.land / x / rambda@v9.1.1 / source / cond.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export function cond(conditions){ return (...input) => { let done = false let toReturn conditions.forEach(([ predicate, getResult ]) => { if (!done && predicate(...input)){ done = true toReturn = getResult(...input) } })
return toReturn }}
rambda

Version Info

Tagged at
2 months ago