Package Exports
- deeply-freeze
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 (deeply-freeze) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Deeply-Freeze
Description
Deeply freezes JS objects (and arrays) effeciently.
Usage
import df from 'deeply-freeze';
const obj = df({
a: "hello",
b: {
a: "world",
b: [1,2,[3,4]]
}
})This creates object 'obj' that is deeply frozen. Neither the object, neither any of the properties (and their properties etc.) can be changed. Trying to mutate the object will not effect the object, and under 'strict mode' will return an error.
How it works
The main function calls itself recursively for each of the properties. It ignores primitives and objects that have already been deeply-frozen. after that it feezes the object itself, and leaves a trace so it can recognize that this object has been deeply frozen in the future.