{"id":31903361,"url":"https://github.com/opensly/is-deep-immutable","last_synced_at":"2026-02-26T18:05:58.780Z","repository":{"id":316394507,"uuid":"1061241786","full_name":"opensly/is-deep-immutable","owner":"opensly","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-21T14:29:27.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T11:40:20.271Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opensly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-21T14:29:26.000Z","updated_at":"2025-09-21T14:29:30.000Z","dependencies_parsed_at":"2025-09-24T11:40:22.033Z","dependency_job_id":"5ef28bc9-83f3-4cd1-9fb8-e48f40f96677","html_url":"https://github.com/opensly/is-deep-immutable","commit_stats":null,"previous_names":["opensly/is-deep-immutable"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/opensly/is-deep-immutable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensly%2Fis-deep-immutable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensly%2Fis-deep-immutable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensly%2Fis-deep-immutable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensly%2Fis-deep-immutable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opensly","download_url":"https://codeload.github.com/opensly/is-deep-immutable/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensly%2Fis-deep-immutable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29867157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T16:38:37.846Z","status":"ssl_error","status_checked_at":"2026-02-26T16:37:58.932Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T13:19:50.181Z","updated_at":"2026-02-26T18:05:58.773Z","avatar_url":"https://github.com/opensly.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# is-deep-immutable\n\n\u003e TypeScript-first utility to check deep immutability in JavaScript objects\n\n[![npm version](https://img.shields.io/npm/v/is-deep-immutable.svg)](https://www.npmjs.com/package/is-deep-immutable)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nTiny zero-dependency library to detect and assert deep immutability.  \nWorks with plain objects, arrays, Maps, Sets, Dates, and nested structures.  \nShips with full TypeScript support and ESM-only build.\n\n---\n\n## Features\n\n- **TypeScript-first** — strong type guards like `value is DeepImmutable\u003cT\u003e`\n- **Deep immutability checks** — recursive checks across nested structures\n- **Helpful errors** — `assertImmutable` shows the exact path of mutability\n- **Zero dependencies** — small, fast, tree-shakable\n- **Modern packaging** — ESM, Node 18+, Deno, Bun\n\n---\n\n## Install\n\n```sh\nnpm install is-deep-immutable\n```\n\n---\n\n## Usage\n\n```typescript\nimport { isDeepImmutable, assertImmutable } from 'is-deep-immutable';\n\nconst data = {\n  users: [{ id: 1, name: 'Alice' }],\n  metadata: new Map([['version', '1.0.0']]),\n  tags: new Set(['production'])\n};\n\n// Check if deeply immutable\nconsole.log(isDeepImmutable(data)); // false\n\n// Manually freeze for testing\nconst frozen = Object.freeze({\n  users: Object.freeze(data.users.map(u =\u003e Object.freeze(u))),\n  metadata: Object.freeze(data.metadata),\n  tags: Object.freeze(data.tags)\n});\nconsole.log(isDeepImmutable(frozen)); // true\n\n// Assert immutability (throws if not)\nassertImmutable(frozen); // ✓ passes\nassertImmutable(data);   // ✗ throws with detailed path\n```\n\n---\n\n## API\n\n### `isDeepImmutable(value): boolean`\n\nType guard that checks if a value is deeply immutable. Returns `true` for primitives and recursively frozen objects.\n\n```typescript\nisDeepImmutable(42);                    // true\nisDeepImmutable('hello');               // true  \nisDeepImmutable({});                    // false\nisDeepImmutable(Object.freeze({}));     // true\n```\n\n### `assertImmutable(value): asserts value is DeepImmutable\u003cT\u003e`\n\nAsserts that a value is deeply immutable. Throws with the exact path of mutability if not.\n\n```typescript\nassertImmutable({ mutable: true });\n// Error: Value is not immutable at path \"root\": Object is not frozen\n\nassertImmutable({ nested: { mutable: true } });  \n// Error: Value is not immutable at path \"nested\": Object is not frozen\n```\n\n\n\n---\n\n## TypeScript Support\n\nFull TypeScript support with the `DeepImmutable\u003cT\u003e` utility type:\n\n```typescript\ntype DeepImmutable\u003cT\u003e = T extends (infer U)[]\n  ? ReadonlyArray\u003cDeepImmutable\u003cU\u003e\u003e\n  : T extends Map\u003cinfer K, infer V\u003e\n  ? ReadonlyMap\u003cDeepImmutable\u003cK\u003e, DeepImmutable\u003cV\u003e\u003e\n  : T extends Set\u003cinfer U\u003e\n  ? ReadonlySet\u003cDeepImmutable\u003cU\u003e\u003e\n  : T extends object\n  ? { readonly [K in keyof T]: DeepImmutable\u003cT[K]\u003e }\n  : T;\n```\n\n---\n\n## Supported Types\n\n- **Primitives**: `string`, `number`, `boolean`, `null`, `undefined`, `symbol`, `bigint`\n- **Objects**: Plain objects with recursive property checking\n- **Arrays**: Recursive element checking  \n- **Maps**: Key and value immutability checking\n- **Sets**: Element immutability checking\n- **Dates**: Treated as immutable when frozen\n- **Circular references**: Handled safely without infinite recursion\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensly%2Fis-deep-immutable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopensly%2Fis-deep-immutable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensly%2Fis-deep-immutable/lists"}