{"name":"@bloomberg/record-tuple-polyfill","version":"0.0.4","description":"A polyfill for the Record and Tuple Stage 2 ECMAScript proposal.","main":"lib/index.umd.js","module":"lib/index.esm.js","scripts":{"clean":"rm -rf ./lib"},"repository":{"type":"git","url":"git+https://github.com/bloomberg/record-tuple-polyfill.git"},"keywords":["record","tuple","record and tuple","polyfill","ecmascript"],"author":{"name":"Rick Button","email":"rbutton2@bloomberg.net"},"contributors":[{"name":"Robin Ricard","email":"rricard2@bloomberg.net"},{"name":"Nicolò Ribaudo","email":"nribaudo1@bloomberg.net"}],"license":"Apache-2.0","publishConfig":{"access":"public"},"gitHead":"61ab72bc792f71d9779894cc2cd9df5429614799","bugs":{"url":"https://github.com/bloomberg/record-tuple-polyfill/issues"},"homepage":"https://github.com/bloomberg/record-tuple-polyfill#readme","_id":"@bloomberg/record-tuple-polyfill@0.0.4","_nodeVersion":"17.0.1","_npmVersion":"8.1.0","dist":{"integrity":"sha512-h0OYmPR3A5Dfbetra/GzxBAzQk8sH7LhRkRUTdagX6nrtlUgJGYCTv4bBK33jsTQw9HDd8PE2x1Ma+iRKEDUsw==","shasum":"9ef3df44e472ceb9a0a2010d858a526f2021fefa","tarball":"http://registry-npm.ywwl.com/@bloomberg/record-tuple-polyfill/download/@bloomberg/record-tuple-polyfill-0.0.4.tgz","fileCount":4,"unpackedSize":62942,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzIEUCRA9TVsSAnZWagAAlygP/0M9rMlxlZaV+PJnXoEl\nbp76UoDUeT3AmARSy5Wks+DFHpWwhDrDV3ek4df2izIgxErp6MagSATyWT65\njPxzCfqpMM4bhTzhAMezYZqI+NmPtpLfbTkPqvJ/ChxW9nwm94ZK5N+zSi5G\nEkpuh01ubCrewiDunNUK1v6Dt6SIePJoIMPsJqBKVwBJ0++OytzkdX0+wpct\nlEXR4ai7Yj6++7CerthcTYEgPJ5wP/9QRpllTQ5sfo4kE8NmflcRWRFsIa2V\nfo2pWLjq49E1wiQsI9lR1gqRkULlDKErwU5uSY4pt8BpTLqzRHBD7NipVkfr\n9HQSgZYimLNqSJthnny8mocIxfThwmtlMAZSD04U1BF8Qx5/K5grWvXFUcDP\nyqInQ/0qgBW3H2ry9Mg8mFId2g9dIcu5gNin44U9zg6Q6LCESnwc6xVq6dFm\nFu5PxhL3kJWodlqRjF2ei+tE/PxP490aj9zxnSZ30a6Q/NEhxqYrTZ3uzYLJ\nqwWBBXRFlDrIMhqW68GeQmvhJUAPyVb9x5oUbgZjfGjBj7m6NmoBXYFcGhSV\nuLH0iOv0dnutbtAKA4ipjhshiUQIeq4Qike0A5SXu+kGh1D/PKRAHmooOtWO\nrKC6absg63sxLtKipFs+o1otwpl7UVDCkWvvX8yio/0eWVwXobWBbGvOfzxe\nSSBx\r\n=3t6W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrGvGeGHntsLAGHGgYTOHOlps5NAdZMhbW0mWlx3yqJwIgXpq5KsjcJOEnRvJ6lipYJsWpr3t6k3BkNg6U1++L5OY="}],"size":11289,"noattachment":false,"key":"/@bloomberg/record-tuple-polyfill/-/@bloomberg/record-tuple-polyfill-0.0.4.tgz"},"_npmUser":{"name":"bbgbuilder","email":"ossbuilder@bloomberg.net"},"directories":{},"maintainers":[{"name":"kpfleming","email":"kevin@km6g.us"},{"name":"bloomberg-oss","email":"opensource@bloomberg.net"},{"name":"bbgbuilder","email":"ossbuilder@bloomberg.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/record-tuple-polyfill_0.0.4_1635277260672_0.4303316034988902"},"_hasShrinkwrap":false,"readme":"# Record & Tuple Polyfill\nThe [Record and Tuple](https://github.com/tc39/proposal-record-tuple) ECMAScript proposal introduces new deeply immutable value types to JavaScript\nthat have similar access idioms to objects and arrays.\n\nThis is an **experiemental and explicitly not production ready** polyfill for the `Record and Tuple` proposal, and a [babel](https://babeljs.io) transform to support using the literal syntax.\n\nThe polyfill and transform are **constant works in progress** and are not the source of truth for the proposal.\n\n# Requirements\n\nIn order to use the syntax transform, [babel](https://babeljs.io) must be installed with at least version `7.9.0`.\n\nIn order to use the polyfill, the environment must support `WeakMap`, [`WeakRef`, and `FinalizationRegistry`](https://github.com/tc39/proposal-weakrefs). If implementations of these features are not provided, an error will be thrown.\n\n# Installation\n\n> Note: the Babel transform described below is not currently published on NPM, [as it is awaiting review](https://github.com/babel/babel/pull/12145).\n> If you really want to try the Babel transform plugin in it's packaged state, publishing locally via [verdaccio](https://verdaccio.org/) is an excellent option.\n\nTo install the transform and polyfill:\n\n```\n# install the babel transform as a dev dependency, only needed at compile time\nnpm install -D @bloomberg/babel-plugin-proposal-record-tuple\n\n# install the polyfill as a regular dependency, needed at runtime\nnpm install --save @bloomberg/record-tuple-polyfill\n```\n\nNext, add the plugin to your `babel` configuration. Example:\n\n```json\n{\n    \"plugins\": [[\"@bloomberg/babel-plugin-proposal-record-tuple\", { \"syntaxType\": \"hash\" }]]\n}\n```\n\n> Note, the `syntaxType` option is required, and must be set to either `hash` or `bar`.\n\n# Usage\n\nIf the `babel` transform and the polyfill are setup, you can start using the `Record and Tuple` literal syntax.\n\n```js\nconsole.log(#{ a: 1 } === #{ a: 1 });\nconsole.log(#[1, 2, 3] === #[1, 2, 3]);\n```\n\nIf you want to use the Record or Tuple global objects, you can import them from the polyfill directly.\n\n```js\nimport { Record, Tuple } from \"@bloomberg/record-tuple-polyfill\";\n\nconst record = Record({ a: 1 });\nconst tuple = Tuple(1, 2, 3);\nconst array = [1,2,3];\n\nconsole.log(Record.isRecord(record));\nconsole.log(Record.keys(record));\nconsole.log(Tuple.from(array));\n```\n\n# Unsupported Features\n\n`typeof` will return an incorrect value when provided a `Record` or `Tuple`.\nThis is because the polyfill implements the proposal via [interning](https://en.wikipedia.org/wiki/String_interning) frozen objects.\n\n# Playground\n\nThe Record and Tuple polyfill has been deployed in an easy to use REPL [here](https://rickbutton.github.io/record-tuple-playground/).\n\n## Supported Environments/Browsers\n\nThe Record and Tuple polyfill requires several JavaScript features that are only available experimentally in browsers, specifically `WeakRef` and `FinalizationRegistry`.\n\nThe following environments support these experimental features out-of-the-box.\n\n| environment     | supported                                |\n|-----------------|------------------------------------------|\n| [Chrome Canary](https://www.google.com/chrome/canary/)   | :heavy_check_mark:                       |\n\n\nIn order to use these experimental features other browsers, you must run the browser/environment with specific flags:\n\n| environment     | flags                                    |\n|-----------------|------------------------------------------|\n| node            | --harmony-weak-refs                      |\n| Chrome          | --js-flags=\"--harmony-weak-refs\"         |\n| Firefox Nightly | javascript.options.experimental.weakrefs |\n","publish_time":1635277260850,"_cnpm_publish_time":1635277260850,"dist-tags":{"latest":"0.0.4"}}