RunKit + npm: immutability-helper

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