Created
June 22, 2018 20:16
-
-
Save sebabouche/93672b1f339992e45dfceaf3150a9a3e to your computer and use it in GitHub Desktop.
ramda: ifElse, gte, lt, always, identity, whn, unless
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ifElse, gte, lt, __, always, identity, when, unless } from "ramda" | |
// const forever21 = age => (age >= 21 ? 21 : age) | |
// const forever21 = ifElse(gte(__, 21), always(21), identity) | |
// const forever21 = unless(lt(__, 21), always(21)) | |
const forever21 = when(gte(__, 21), always(21)) | |
console.log("forever21(24)", forever21(24)) | |
console.log("forever21(16)", forever21(16)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment