Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: immutability-helper
node v4.9.1
endpoint
share
tweet
function Foo() { this.bar = true } Foo.prototype.foos = function() { console.log('fooing ' + this.test ) } var update = require("immutability-helper") var o1 = {foo: new Foo, arr: []} var o2 = update(o1, {foo: {test: {$set: 'thing'}}}); o2.foo.foos() // "fooing thing" var o3 = update(o1, {arr: {0: {$set: 'value'}}}) o3.arr.map(v => v.toUpperCase()) // ['VALUE']
Created from: https://runkit.com/npm/immutability-helper
Loading…
no comments
sign in
to comment