JSPM

deep-freeze-plus

1.1.4
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 94
    • Score
      100M100P100Q73966F
    • License MIT

    An ultra-fast and efficient library for deeply freezing JavaScript objects and preventing unintended mutations. Supports all data types, including complex objects like maps and sets, and guarantees immutability without recursion. Ideal for applications that require strict data immutability and performance-critical use cases.

    Package Exports

    • deep-freeze-plus
    • deep-freeze-plus/index.js

    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-plus) 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-plus

    npm version npm downloads Build Status Coverage Status

    A fast and efficient implementation of the deepFreeze function for freezing JavaScript objects and arrays without recursion. Supports all primitive types, objects, arrays, Maps, Sets, and other complex data structures.

    Installation

    To install deep-freeze-plus using npm:

    npm install deep-freeze-plus

    To install deep-freeze-plus using yarn:

    yarn add deep-freeze-plus

    Usage

    To use deep-freeze-plus in your project, simply import the deepFreeze function and pass in the object or array you want to freeze:

    const { deepFreeze } = require('deep-freeze-plus');
    
    const obj = {
      a: 1,
      b: {
        c: 2,
        d: [3, 4],
        e: new Set([5, 6, 7]),
        f: new Map([['foo', 'bar'], ['baz', 'qux']]),
      },
    };
    
    deepFreeze(obj);
    
    obj.a = 100; // Throws an error
    obj.b.c = 200; // Throws an error
    obj.b.d[0] = 300; // Throws an error
    obj.b.e.add(8); // Throws an error
    obj.b.f.set('hello', 'world'); // Throws an error

    Contributing

    We welcome contributions to deep-freeze-plus! If you find a bug or have a feature request, please open an issue or submit a pull request.

    Before contributing, please review the contributing guidelines.