Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.55 KB

README.md

File metadata and controls

30 lines (20 loc) · 1.55 KB

tiny-immutable-set

A minimal, immutable, deep set utility for Javascript objects and arrays.

Inspired by, and based on, NickGard's tiny-get

npm version build status dependencies status gzip size test coverage

Usage

import { set } from 'tiny-immutable-set';

const newState = set(state, 'deep.path', newValue);

The original state is not modified.

Notes

  • If you're using lodash then you don't need this: see this thread for alternatives.

  • The small bundle size of this library comes with a slight speed tradeoff. This library is a little slower than immutable-assign and immutable.js, but a little faster than Immer and seamless-immutable. It's faster if you use a string path instead of an array of path parts. See full benchmark here.