@se-oss/deep-freeze
v1.0.0
Published
Recursively freezes objects and arrays to make them immutable, with TypeScript support.
Downloads
29
Maintainers
Readme
@se-oss/deep-freeze
@se-oss/deep-freeze is a utility for deep-freezing objects.
📦 Installation
npm install @se-oss/deep-freezepnpm
pnpm install @se-oss/deep-freezeyarn
yarn add @se-oss/deep-freeze📖 Usage
import { deepFreeze } from '@se-oss/deep-freeze';
const obj = {
a: 1,
b: { c: 2 },
d: [1, 2],
};
deepFreeze(obj);
// obj is now immutable:
// obj.a = 2; // Error
// obj.b.c = 3; // Error
// obj.d.push(3); // Error📚 Documentation
For all configuration options, please see the API docs.
🤝 Contributing
Want to contribute? Awesome! To show your support is to star the project, or to raise issues on GitHub.
Thanks again for your support, it is much appreciated! 🙏
License
MIT © Shahrad Elahi and contributors.
