object-path-immutable icon indicating copy to clipboard operation
object-path-immutable copied to clipboard

Ability to bind the chain mode to a slice of the object

Open mariocasciaro opened this issue 7 years ago • 0 comments

immutable(object, 'path.to.slice')

const obj = {
  a: {
    b: 's1',
    c: 1
  }
}

immutable(obj, 'a')
  .set('b', 's3')
  .update('c', (v) => v+1)
  .value() 

/*
returns {
  a: {
    b: 's3',
    c: 2
  }
}
*/

mariocasciaro avatar May 31 '18 13:05 mariocasciaro