Created
June 22, 2018 20:19
-
-
Save sebabouche/a42112fbd0d8e87b5cbb8a9ee69e900c to your computer and use it in GitHub Desktop.
ramda: assoc, assocPath, dissoc, dissocPath, omit, compose, inc, prop
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 { assoc, assocPath, dissoc, dissocPath, omit, compose, inc, prop } from "ramda" | |
const original = { | |
a: "Bingo", | |
b: { | |
c: "Bingo", | |
d: "Bingo", | |
}, | |
} | |
const updated1 = assoc("a", "Yes!", original) | |
const updated2 = assocPath(["b", "c"], "Yes!", original) | |
console.log("updated1", updated1) | |
console.log("updated2", updated2) | |
const updated3 = dissoc("a", original) | |
const updated4 = dissocPath(["b", "c"], original) | |
console.log("updated3", updated3) | |
console.log("updated4", updated4) | |
const update5 = omit(["a", "b"], original) | |
console.log("update5", update5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment