Package Exports
- deep-unfreeze
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deep-unfreeze) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
deep-unfreeze
Unfreeze a JavaScript object/array/function that has previously been frozen (and deeply frozen) with Object.freeze, by doing a copy.
Usage
import deepUnfreeze from 'deep-unfreeze';
let subject,
result;
subject = {};
Object.freeze(subject);
// Doesn't add the property.
// subject.lorem = 'LOREM';
result = deepUnfreeze(subject);
result.lorem = 'LOREM';import deepUnfreeze from 'deep-unfreeze';
let subject,
result;
subject = [];
Object.freeze(subject);
// Throws an error.
// subject.push('LOREM');
result = deepUnfreeze(subject);
result.push('LOREM');import deepUnfreeze from 'deep-unfreeze';
let subject,
result;
subject = function() {
};
Object.freeze(subject);
Object.freeze(subject.prototype);
// This won't work.
// subject.prototype.sayLorem = function() { console.log('LOREM'); };
// new subject().sayLorem() // TypeError: (intermediate value).sayIpsum is not a function
result = deepUnfreeze(subject);
result.prototype.sayIpsum = function() { console.log('IPSUM'); };
// new result().sayIpsum() // "IPSUM"Download
Download using NPM:
npm install deep-unfreezeTests
Run unit tests (check that all dependencies are installed):
npm install && npm run test