1.0.1 • Published 6 years ago

immut-set v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

immut-set

A small helper function, which exposes an immutable version of lodash.set

Installation

Using npm:

npm install immut-set --save

Usage

Basic example:

const set = require('immut-set')

const object = {
  'a': [{
    'b': {
      'c': 1
    }
  }]
}

const updatedObject = set(object, 'a[0].b.c', 0)

console.log(object)
/*
{
  'a': [{
    'b': {
      'c': 1
    }
  }]
}
*/

console.log(updatedObject)
/*
{
  'a': [{
    'b': {
      'c': 0
    }
  }]
}
*/