JSPM

deep-freeze-strict

1.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 327213
  • Score
    100M100P100Q186584F
  • License public domain

recursively Object.freeze() objects and functions, works in strict mode

Package Exports

  • deep-freeze-strict

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-freeze-strict) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

deep-freeze-strict

recursively Object.freeze() objects.

this fork works in strict mode, so when freezing a function you don't get the error:

> (function(){ "use strict"; deepFreeze(function(){}); })();

TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them

example

var deepFreeze = require('deep-freeze-strict');

deepFreeze(Buffer);
Buffer.x = 5;
console.log(Buffer.x === undefined);

Buffer.prototype.z = 3;
console.log(Buffer.prototype.z === undefined);

$ node example/deep.js
true
true

methods

var deepFreeze = require('deep-freeze-strict')

deepFreeze(obj)

Call Object.freeze(obj) recursively on all unfrozen properties of obj that are functions or objects.

license

public domain

Based in part on the code snippet from the MDN wiki page on Object.freeze(), which is released to the public domain.