Skip to content

Instantly share code, notes, and snippets.

@taroyanaka
Forked from sebabouche/ramda2.js
Created October 24, 2018 02:38
Show Gist options
  • Save taroyanaka/89621b445cad7deb71e836522343b272 to your computer and use it in GitHub Desktop.
Save taroyanaka/89621b445cad7deb71e836522343b272 to your computer and use it in GitHub Desktop.
ramda: ifElse, gte, lt, always, identity, whn, unless
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