-
-
Save taroyanaka/89621b445cad7deb71e836522343b272 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