Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deep-freeze

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-freeze

recursively Object.freeze() objects and functions

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
868K
increased by2.77%
Maintainers
1
Weekly downloads
 
Created

What is deep-freeze?

The deep-freeze npm package is used to recursively freeze objects, making them immutable. This means that once an object is frozen, it cannot be modified, which is useful for ensuring the integrity of data structures in JavaScript applications.

What are deep-freeze's main functionalities?

Deep Freezing Objects

This feature allows you to deeply freeze an object, making it and all nested objects immutable. Any attempts to modify the object or its nested properties will fail silently in non-strict mode or throw an error in strict mode.

const deepFreeze = require('deep-freeze');

const obj = {
  a: 1,
  b: {
    c: 2
  }
};

deepFreeze(obj);

obj.a = 2; // This will not change the value of obj.a
obj.b.c = 3; // This will not change the value of obj.b.c

console.log(obj); // { a: 1, b: { c: 2 } }

Other packages similar to deep-freeze

Keywords

FAQs

Package last updated on 04 Sep 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc