Skip to content

SudoDotDog/Sudoo-Immutable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sudoo-Immutable

Continuous Integration codecov npm version downloads

Immutable for Typescript

Install

yarn add @sudoo/immutable
# Or
npm install @sudoo/immutable --save

Clone Object

Clone function is supported by @sudoo/duplicated package.

import { clone } from "@sudoo/immutable";

const newObject = clone(object);

Produce Object

Within produce function, you can edit object immutably within mutable method.

import { produce } from "@sudoo/immutable";

const newObject = produce(oldObject, (draft) => {
    object.hello = "world";
});
oldObject // Not Edited
newObject // Edited

Async Produce Object

Within produce function, you can edit object immutably within mutable method.

import { produce } from "@sudoo/immutable";

const newObject = await asyncProduce(oldObject, async (draft) => {
    object.hello = await getWorld();
});
oldObject // Not Edited
newObject // Edited

Advanced

For more advanced way to use this package, see Immutable Medium document.

About

🔐 Immutable for Typescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •