{"_id":"@a11d/is-writable","_rev":"4-d06f57fa780070d8b1520124f4453f26","name":"@a11d/is-writable","dist-tags":{"latest":"1.0.2"},"versions":{"0.0.1":{"name":"@a11d/is-writable","version":"0.0.1","keywords":["object","property","writable","settable"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/is-writable@0.0.1","maintainers":[{"name":"arshia11d","email":"a11delavar@outlook.com"}],"homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"cc5014506cea4f3616bbdb729d80c7aa38718fda","tarball":"https://registry.npmjs.org/@a11d/is-writable/-/is-writable-0.0.1.tgz","fileCount":8,"integrity":"sha512-0fqgG4VbdCnRlYYGei0zlBdikEdHhtACZwesiiSUxbdvMDrZKrPwXJS+ixRLvy9vI6IMdul9o4h0emjM++fMJw==","signatures":[{"sig":"MEUCIQDdTMGM8UA9gqDNsRTNVc/RHRPxlskR1gyP8b/gkvOekwIgYDyiFs+pYA2eoMoFLqGqzfuZHR6HI+WiJGE0kV42g+I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":37400},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"4340c2eb34ef737ed0efff8a333f134d1020235c","_npmUser":{"name":"arshia11d","email":"a11delavar@outlook.com"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"9.6.2","description":"A function on the Object constructor that determines if a property is writable.","directories":{},"_nodeVersion":"20.3.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/is-writable_0.0.1_1697406378366_0.16847609342827963","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@a11d/is-writable","version":"1.0.0","keywords":["object","property","writable","settable"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/is-writable@1.0.0","maintainers":[{"name":"arshia11d","email":"a11delavar@outlook.com"}],"homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"ae361ef2dba3550a9af258ebfbc85f834c040dae","tarball":"https://registry.npmjs.org/@a11d/is-writable/-/is-writable-1.0.0.tgz","fileCount":8,"integrity":"sha512-6CF2DfpilPp0E65rMBe/rzHn990lnx5PBa7zbjM2lL5MULtMWeX20LGn4d7YnqJhaywGQQQK4OYugOYRsImupg==","signatures":[{"sig":"MEQCIDUJb+J5KcWedrl7njDYJULyuA/XMSE8dvefBN2QzRSqAiBm7ScbNVtiTTMsy7Iq1RUXCERc2gs2r88kP6FDNd/0PA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":37400},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"4340c2eb34ef737ed0efff8a333f134d1020235c","_npmUser":{"name":"arshia11d","email":"a11delavar@outlook.com"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"9.6.2","description":"A function on the Object constructor that determines if a property is writable.","directories":{},"_nodeVersion":"20.3.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/is-writable_1.0.0_1697406468402_0.5906190050741797","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@a11d/is-writable","version":"1.0.1","keywords":["object","property","writable","settable"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/is-writable@1.0.1","maintainers":[{"name":"arshia11d","email":"a11delavar@outlook.com"}],"homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"65d0836c8d6665f05560641bf4b7965ff8218c0e","tarball":"https://registry.npmjs.org/@a11d/is-writable/-/is-writable-1.0.1.tgz","fileCount":8,"integrity":"sha512-MH9X/CAU7a2dxNAq3wz5gvNJKEW+YSqXRvsnCJvn05pAgYKUjTyOiC60qA1CUBAAfQykb+OKTGItpGCDAQqaqA==","signatures":[{"sig":"MEQCID/V8prmOdra8vlnU3HnoBQApZW/+3cLLajF3ipi1ApFAiBwZkwz9EhERpq45H0GSS4pHYNFT8JfJDMOVwHhz1fXzw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":37427},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"ba2378f182444af67681f837adff7ed1efca7424","_npmUser":{"name":"arshia11d","email":"a11delavar@outlook.com"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"9.6.2","description":"A function on the Object constructor that determines if a property is writable.","directories":{},"_nodeVersion":"20.3.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/is-writable_1.0.1_1697410506769_0.692622846767037","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@a11d/is-writable","version":"1.0.2","description":"A function on the Object constructor that determines if a property is writable.","repository":{"type":"git","url":"git+https://github.com/a11delavar/lit.git"},"keywords":["object","property","writable","settable"],"author":{"name":"a11delavar"},"license":"MIT","homepage":"https://github.com/a11delavar/lit#readme","type":"module","module":"./dist/index.js","main":"./dist/index.js","types":"./dist/index.d.ts","gitHead":"c9877a220243cd75328add3a76f5125474e4f263","_id":"@a11d/is-writable@1.0.2","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"_nodeVersion":"25.2.1","_npmVersion":"11.6.4","dist":{"integrity":"sha512-m/SRTNFcJMNNy3LxLDH5G1l3uAPsdoiodivnUsDtGZ1Rtu2e1HZnJqLxMGxfGtiicO3R4FDok4JwOLqZCAOYZA==","shasum":"bc8b56ca0b737595be113274e8c9b4797e1012c8","tarball":"https://registry.npmjs.org/@a11d/is-writable/-/is-writable-1.0.2.tgz","fileCount":9,"unpackedSize":37108,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHvE04apW0ngv4+PlmP6wgte9GRlEOOf1FxJ7kFZ7aIsAiBKATTSd7d4gI6Xg9C9OjCY0+/ehN2sh/pzWC4JsX4wzQ=="}]},"_npmUser":{"name":"arshia11d","email":"a@delavar.net"},"directories":{},"maintainers":[{"name":"arshia11d","email":"a@delavar.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/is-writable_1.0.2_1765221019084_0.3366375191162201"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-15T21:46:18.255Z","modified":"2025-12-08T19:10:19.423Z","0.0.1":"2023-10-15T21:46:18.555Z","1.0.0":"2023-10-15T21:47:48.562Z","1.0.1":"2023-10-15T22:55:06.969Z","1.0.2":"2025-12-08T19:10:19.227Z"},"bugs":{"url":"https://github.com/a11delavar/lit/issues"},"author":{"name":"a11delavar"},"license":"MIT","homepage":"https://github.com/a11delavar/lit#readme","keywords":["object","property","writable","settable"],"repository":{"type":"git","url":"git+https://github.com/a11delavar/lit.git"},"description":"A function on the Object constructor that determines if a property is writable.","maintainers":[{"name":"arshia11d","email":"a@delavar.net"}],"readme":"# `@a11d/is-writable`\n\nCheck if an object property is writable, accounting for property descriptors, getters/setters, and the prototype chain.\n\n```typescript\nimport '@a11d/is-writable'\n\nconst obj = { name: 'John' }\nObject.defineProperty(obj, 'id', { value: 123, writable: false })\n\nObject.isWritable(obj, 'name') // true\nObject.isWritable(obj, 'id') // false\n```\n\n## Installation\n\n```bash\nnpm install @a11d/is-writable\n```\n\n## API\n\n<details>\n<summary><code>Object.isWritable(object, key): boolean</code> — Check if a property can be written to</summary>\n\nReturns `true` if the property is writable, `false` otherwise.\n\n```typescript\nconst obj = {}\nObject.defineProperty(obj, 'readonly', { value: 42, writable: false })\n\nObject.isWritable(obj, 'readonly') // false\nObject.isWritable(obj, 'newProp') // true (non-existent properties are writable)\n```\n\nChecks the entire prototype chain:\n\n```typescript\nclass Base {\n\tget value() { return 1 }\n}\n\nclass Child extends Base {}\n\nObject.isWritable(new Child(), 'value') // false (getter-only in prototype)\n```\n</details>\n\n## Behavior\n\n<details>\n<summary>Frozen objects</summary>\n\nReturns `false` for all properties on frozen objects:\n\n```typescript\nconst obj = { name: 'John' }\nObject.freeze(obj)\n\nObject.isWritable(obj, 'name') // false\nObject.isWritable(obj, 'newProp') // false\n```\n</details>\n\n<details>\n<summary>Getters and setters</summary>\n\nGetter-only properties are not writable:\n\n```typescript\nconst obj = {\n\tget value() { return 42 }\n}\n\nObject.isWritable(obj, 'value') // false\n```\n\nProperties with both getter and setter are writable:\n\n```typescript\nconst obj = {\n\tget value() { return this._value },\n\tset value(v) { this._value = v }\n}\n\nObject.isWritable(obj, 'value') // true\n```\n\nSetter-only properties are writable:\n\n```typescript\nconst obj = {\n\tset value(v) { console.log(v) }\n}\n\nObject.isWritable(obj, 'value') // true\n```\n</details>\n\n<details>\n<summary>Non-existent properties</summary>\n\nProperties that don't exist are considered writable (unless the object is frozen):\n\n```typescript\nconst obj = {}\nObject.isWritable(obj, 'newProp') // true\n```\n</details>\n\n<details>\n<summary>Prototype chain</summary>\n\nChecks all descriptors in the prototype chain:\n\n```typescript\nclass Base {\n\tget value() { return 1 }\n}\n\nclass Child extends Base {\n\tget value() { return 2 }\n\tset value(v) { /* add setter alongside getter */ }\n}\n\nObject.isWritable(new Base(), 'value') // false (getter-only)\nObject.isWritable(new Child(), 'value') // true (has both getter and setter)\n```\n</details>\n","readmeFilename":"README.md"}