imut

1.0.0 • Public • Published

imut

This is a lib to make any object imutable

Install

$ npm install imut

Usage

const imut = require('imut');
 
//Only parent object
// Simple usage
const a = {};
imut(a);
a.b = 'test'
console.log(a.b); //undefined
 
// With object property
const a = { b: { c: 'd' } };
imut(a);
a.b = 'test'
console.log(a.b); //test
 
//With childs objects
const a = { b: { c: 'd' } };
imut(a, true);
a.b = 'test'
console.log(a.b); //{ c: 'd' }

API

imut(object, withProps)

Parameter Type Value
object object any object
withProps boolean true or false

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i imut

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • john-luc