{"_id":"@bellisario/icecube","name":"@bellisario/icecube","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bellisario/icecube","version":"1.0.0","description":"Create objects that can be freezed and un-freezed","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Bellisario/IceCube.git"},"homepage":"https://github.com/Bellisario/IceCube#readme","funding":"https://gitbub.com/sponsors/Bellisario","author":{"name":"Giorgio Bellisario"},"type":"module","exports":"./index.js","scripts":{"test":"npm run lint && node ./test.js","lint":"eslint .","lint:fix":"eslint . --fix"},"keywords":["object","freeze","un-freeze"],"devDependencies":{"eslint":"^8.20.0","supertape":"^7.6.0"},"bugs":{"url":"https://github.com/Bellisario/IceCube/issues"},"engines":{"node":">=14.0.0"},"types":"./index.d.ts","gitHead":"96da4dd227237d460887461ec0a174ac56d1582b","_id":"@bellisario/icecube@1.0.0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-i+2AX3OQBQmGnZ0Utfqsj8zSaNfxDR2r7uEfoSrHBX8aXaa3cU/iYNCkU3xg3ut3EburYhgRqPhAmMDDfBpM5g==","shasum":"58fade2a51cd0937b0ea9031a7692d841685afb4","tarball":"https://registry.npmjs.org/@bellisario/icecube/-/icecube-1.0.0.tgz","fileCount":5,"unpackedSize":6111,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA+jU7MjFrB7ltyYyH2tyKBRCPLlmtst2MKdw0Nk3WrzAiEAzZCpFCER8Els5YZ/AgTijrKupsRgR4DMHn/SjUy2DO0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi4DaOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrLZBAAoG6MvtjeCglWhMlOyPwHjg61ZzsFchUgcTwcTPqlLEH6gSuT\r\nGbT1GCNuS1R4TncMa8/jPoS4QUTRsxrxLE6uT/tGumSBiBF6k3jiD5KX0JWM\r\nL1v8eOUZxkCiKGdv+8ainE5ZJcjbjhrTfHfTik4oC5uwYHSiYXpbyj9VM8dn\r\nBDZCn8WqG3JOFuNzYsMYhRMsibtwGlCVWliqhP4t463K1yeuI49wPJCIwD2j\r\ny8tzIm84JHsy/g+6porPDhpEDwJvBxRLNk3LARloKCQQpyrnMkoQUSvmxTXl\r\n1tM3Nz6NW6P4lvG8mGA0C7mi8wJzVQbfok+WJcCC7Jki05Akzbf/EMAFXQs2\r\nTyfgG+5m0p4I6dziwRUTmdJ7PsehpJoN5F3ZFT0HFTO5yR/8/w0JuJQY91kk\r\ndFh7kXH0XpiLWmV8h54bKJytha8qp2s25cckmtFucsdbQQC3T+Dsj5DtaJRA\r\nnBDpQy/txjlBn+CXZK/HYbR7v0NThxHnOXT2csiSbZM5hfSBl17ctNkp32lw\r\n0xUnj+Mi0gEvVJmGdF8cfyB0WuATe1FD8C07X36RW4GRPhoWecyCNLJ8PR0W\r\nT3xjPK+F99/MkCa200YtwLd5FIFWwM7ZPVFtvNp+NDl7u+LyXZ0g3qq9WRoQ\r\nkZY4ZeCxeX8chWZFZg4BiVveOhIKzNBd0ss=\r\n=KXOG\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bellisario","email":"bellisario.dev@outlook.com"},"directories":{},"maintainers":[{"name":"bellisario","email":"bellisario.dev@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/icecube_1.0.0_1658861198261_0.28914692300830036"},"_hasShrinkwrap":false}},"time":{"created":"2022-07-26T18:46:38.206Z","1.0.0":"2022-07-26T18:46:38.448Z","modified":"2022-07-26T18:46:38.580Z"},"maintainers":[{"name":"bellisario","email":"bellisario.dev@outlook.com"}],"description":"Create objects that can be freezed and un-freezed","homepage":"https://github.com/Bellisario/IceCube#readme","keywords":["object","freeze","un-freeze"],"repository":{"type":"git","url":"git+https://github.com/Bellisario/IceCube.git"},"author":{"name":"Giorgio Bellisario"},"bugs":{"url":"https://github.com/Bellisario/IceCube/issues"},"license":"MIT","readme":"<!-- cspell:word vexels -->\r\n\r\n<p align=\"center\"><img src=\"https://github.com/Bellisario/IceCube/blob/main/assets/Ice%20Cube.svg\" alt=\"Ice Cube\" width=\"150\" height=\"150\" /></p>\r\n<p></p>\r\n<h1 align=\"center\">Ice Cube</h1>\r\n\r\n> Create objects that can be freezed and un-freezed\r\n\r\n## Example\r\n\r\n```js\r\nimport { IceCube } from '@bellisario/icecube';\r\nconst obj = new IceCube({ test: true });\r\n\r\nobj.test; // returns true\r\nobj.test = false; // throws an error\r\n\r\nobj.iced = false; // disables freezing\r\nobj.test = false; // succeeds\r\nobj.test; // false\r\n```\r\n\r\n## Usage\r\n\r\n### new IceCube(obj, options?)\r\n\r\nCreates a new instance of the `IceCube` class.\\\r\nReturns an usable object that can be freezed/un-freezed.\r\n\r\n#### obj\r\n\r\nType: `object`\\\r\nThe object to be freezed. Can also be an array.\r\n\r\n#### options\r\n\r\nType: `object`\\\r\nRequired: `false`\\\r\nInitialization options.\r\n\r\n##### iced\r\n\r\nType: `boolean`\\\r\nDefault: `true`\\\r\nIf `true`, the object will be freezed when created.\\\r\nIf `false`, the object will not be freezed when created and can be edited.\r\n\r\n#### Object returned\r\n\r\nType: `object`\\\r\nThe object that can be freezed/un-freezed.\r\n\r\n##### Properties\r\n- **iced**: `boolean`\\\r\n  Default: specified by the user `iced` option\\\r\n  Controls whether or not the object is frozen.\\\r\n  Edit this property to freeze/un-freeze the object.\r\n\r\n## Why?\r\n\r\nSince I started learning JavaScript, I noticed that freezing objects will not allow you to un-freeze them later, this is very useful in certain situations, but some others you just want to prevent the user from editing the object now, but allow them to edit it later...\\\r\nSo I created this library to solve this problem.\r\n\r\n## How?\r\n\r\nYou can see on the source code of the library that I used Proxy to \"watch\" the object, then allow editing (or throw an error) by looking for the `iced` property (which is instead always editable).\r\n\r\n## Contributing\r\n\r\nWe :heart: contributions!\\\r\nFeel free to open an [issue](https://github.com/Bellisario/IceCube/issues) or a [pull request](https://github.com/Bellisario/IceCube/pulls) but follow [Contributing Guidelines](https://github.com/Bellisario/ice-cube/blob/main/CONTRIBUTING.md).\r\n\r\n> **Tip:** if you don't know where to start, check out the [help wanted issues](https://github.com/Bellisario/IceCube/labels/help%20wanted)!\r\n\r\n## License\r\nMIT License [here](https://github.com/Bellisario/IceCube/blob/main/LICENSE).\r\n\r\n---\r\n\r\n<p align=\"center\">Ice Cube original image from <a target=\"_blank\" href=\"https://www.vexels.com/png-svg/preview/232100/ice-cube-melting-illustration\">vexels.com</a></p>\r\n","readmeFilename":"README.md"}