/nestedfreeze

Object.freeze nested objects

Primary LanguageJavaScriptMIT LicenseMIT

nestedfreeze

Javascript's Object.freeze does not recursively freeze objects. This module does that for you.

nestedfreeze is faster than deepfreeze.

Install

npm install nestedfreeze --save

Usage

const freeze = require('nestedfreeze')

let obj = {
  foo: {
    baz: 'do esse esse et dolor'
  },
  bar: {
    qux: 'sit cupidatat anim occaecat elit'
  }
}

freeze(obj)

obj.foo.baz = 'change me'
console.log(obj.foo.baz) // do esse esse et dolor

Test

npm run test