Home

Awesome

object-unfreeze

Travis build status NPM version

Unfreeze an object frozen with Object.freeze.

Usage

import objectUnfreeze from 'object-unfreeze';

let subject,
    shallowCopy;

subject = {};

Object.freeze(subject);

// Throws an error.
// subject.foo = 'FOO';

shallowCopy = objectUnfreeze(subject);

shallowCopy.foo = 'FOO';

import objectUnfreeze from 'object-unfreeze';

let subject,
    shallowCopy;

subject = [];

Object.freeze(subject);

// Throws an error.
// subject.push('FOO');

shallowCopy = objectUnfreeze(subject);

shallowCopy.push('FOO');

Download

Download using NPM:

npm install object-unfreeze