{"name":"@offirmo/globalthis-ponyfill","description":"Ponyfill for globalThis","version":"3.0.2","author":{"name":"Offirmo","email":"offirmo.net@gmail.com"},"license":"Unlicense","esnext":"dist/src.es2019/index.js","module":"dist/src.es2019/index.js","main":"dist/src.es2019.cjs/index.js","typings":"dist/src.es2019.cjs/index.d.ts","source":"src/index.ts","sideEffects":false,"size-limit":[{"limit":"200B","path":"dist/src.es2019/index.js"},{"limit":"200B","path":"dist/src.es2019.cjs/index.js"}],"peerDependencies":{},"dependencies":{},"scripts":{"clean":"node ../../0-scripts/clean.js …dist","build:dev:watch":"node ../../0-scripts/build-typescript.js --watch","build:prod":"node ../../0-scripts/build-typescript.js","ensure-size":"size-limit","dev":"run-s clean build:dev:watch","build":"run-s build:prod","np":"np --no-publish","prepublishOnly":"run-s clean build:prod ensure-size"},"devDependencies":{"@size-limit/preset-small-lib":"^5","np":"^7","npm-run-all":"^4","size-limit":"^5"},"repository":{"type":"git","url":"git+https://github.com/Offirmo/offirmo-monorepo.git#master"},"keywords":["globalThis","ponyfill","typescript"],"homepage":"https://github.com/Offirmo/offirmo-monorepo/tree/master/1-stdlib/globalthis-ponyfill","bugs":{"url":"https://github.com/Offirmo/offirmo-monorepo/issues"},"gitHead":"9e9b483baf4f977c201aca79b65d7c7e3cc79271","_id":"@offirmo/globalthis-ponyfill@3.0.2","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"integrity":"sha512-GZ1g9mzYNKs4wKoUf3//nW7/DZGe8SznPnHXKvEJJZqWPoM7SsXP7+L5FPyFnB4bUOzuYb60V2LDOasC6eBWBA==","shasum":"c300d3ccfcc5db9052580ac0e14fa964f6d1ec59","tarball":"http://registry-npm.ywwl.com/@offirmo/globalthis-ponyfill/download/@offirmo/globalthis-ponyfill-3.0.2.tgz","fileCount":9,"unpackedSize":7575,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCtTMGp1et/foSks2jfpYdcHbDmiwk6sjLbbgEPKeI01gIhAKCbkcFNxj9xcCUU90U2yYAzafj3/aQFdiyLT6LoDjev"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiSAD6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrXAA//S5bubhX9jaNx0rl+vKEsg7VJi7mkK+NwMxLfTubToFGwjtJM\r\niBcx11B7c3a9fsIIhAaRNNjNAbmHiRWa6tTClDoPydx2scyAZQvXYFuw6AWp\r\nwTlDaBmY1dfaYWh4TTBXH2Ar3w3TIJ6ZMSjOeTAhW9+khkyrVfJClCjfUa74\r\niAIEyY8Ftmo4O1k16XI97CigqW9PvDEqJIZsRZcIPD1EhK37wviAdbntlwdh\r\nuM67lemE6w8sEx3Zfvl5K54z65/krrBb82nJnLay41tg+rBUHXociAxvmSmQ\r\nNGgBW4fQhczTo6yYpw7A6TNGQWWu42g5M8WhH2C8vpexoEblYdnwN5HZzyqW\r\n7A8+yBCvzFHF5jHadS26An11y0zqi5Osu0D2NGDLnIUG+E+EoyGars/5+PV2\r\n61maw7w4IpVQ2WF85Sa/k13ZEgW+Z67RdaZO2371h7Q/jq8XvpmNFczRAU3N\r\nMsPudhRMP0xa3JNLtAtEBoxF+tQLDFIlkxv3qVeKIukyLWRCyQ6/A3F3PULV\r\n/LRwRUvCBuDFTtKMcQVKFeEI117AgApK9aHGr+dq9M76JkSxd4Q3cxr5A5A4\r\n/Iy1IFq0Ap2tlEPwT87aqARkvBxul3+QtJGuEYLDYI9sBj50CCkDUJSECh+y\r\ncYsbHmxHtVqEir8AjqngLUt104rh9jhGl/Q=\r\n=Tab4\r\n-----END PGP SIGNATURE-----\r\n","size":2556,"noattachment":false,"key":"/@offirmo/globalthis-ponyfill/-/@offirmo/globalthis-ponyfill-3.0.2.tgz"},"_npmUser":{"name":"offirmo","email":"offirmo.net@gmail.com"},"directories":{},"maintainers":[{"name":"offirmo","email":"offirmo.net@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/globalthis-ponyfill_3.0.2_1648886010404_0.2987457085749161"},"_hasShrinkwrap":false,"readme":"\n<h1 align=\"center\">\n\tglobalThis ponyfill<br>\n\t<a href=\"https://www.offirmo.net/offirmo-monorepo/0-doc/modules-directory/index.html\">\n\t\t<img src=\"https://www.offirmo.net/offirmo-monorepo/public/offirmos_quality_seal.png\" alt=\"Offirmo’s quality seal\" width=\"333\">\n\t</a>\n</h1>\n\n<p align=\"center\">\n\t<a alt=\"npm package page\"\n\t  href=\"https://www.npmjs.com/package/@offirmo/globalthis-ponyfill\">\n\t\t<img alt=\"npm badge\"\n\t\t  src=\"https://img.shields.io/npm/v/@offirmo/globalthis-ponyfill.svg\">\n\t</a>\n\t<a alt=\"dependencies analysis\"\n\t  href=\"https://david-dm.org/offirmo/offirmo-monorepo?path=1-stdlib%2Fglobalthis-ponyfill\">\n\t\t<img alt=\"dependencies badge\"\n\t\t  src=\"https://img.shields.io/david/offirmo/offirmo-monorepo.svg?path=1-stdlib%2Fglobalthis-ponyfill\">\n\t</a>\n\t<a alt=\"bundle size evaluation\"\n\t  href=\"https://bundlephobia.com/result?p=@offirmo/globalthis-ponyfill\">\n\t\t<img alt=\"bundle size badge\"\n\t\t  src=\"https://img.shields.io/bundlephobia/minzip/@offirmo/globalthis-ponyfill.svg\">\n\t</a>\n\t<a alt=\"license\"\n\t  href=\"https://unlicense.org/\">\n\t\t<img alt=\"license badge\"\n\t\t  src=\"https://img.shields.io/badge/license-public_domain-brightgreen.svg\">\n\t</a>\n\t<img alt=\"maintenance status badge\"\n\t  src=\"https://img.shields.io/maintenance/yes/2022.svg\">\n</p>\n\n\nThis is a trivial TypeScript-compatible [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis) [ponyfill](https://ponyfill.com/).\n* very small minzipped size\n* NO dependencies\n* doesn't alter the environment ([ponyfill](https://ponyfill.com/))\n* compatible with node & browser\n\n\n## Usage\n```js\nimport { getGlobalThis } from '@offirmo/globalthis-ponyfill'\n\n// typed access\ndeclare global {\n\tvar foo: number\n}\nconst globalThis = getGlobalThis()\nglobalThis.foo = 42\n\n// untyped access\nconst globalThis = getGlobalThis<any>()\nglobalThis.bar = 42\n```\n\n\n## Rationale\n\n* `globalThis` is a [TC-39 proposal](https://github.com/tc39/proposal-global)\n which is [already supported by Firefox and Chrome](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis).\n* There are existing ponyfills/polyfills [out there](https://github.com/ljharb/globalThis), but they didn't work for me:\n  * mine is much simpler: a single TS file of 6 meaningful lines\n  * I needed TypeScript\n  * a [ponyfill](https://ponyfill.com/) is better than a polyfill, it doesn't patch the environment.\n\n\n\n\n## Credits\n\n**YES** I had a look at [ljharb/globalThis](https://github.com/ljharb/globalThis) 's [implementation](https://github.com/ljharb/globalThis/blob/master/implementation.js) (MIT)\nand started my implementation from it! Thanks a lot and all credits due!\n\nAbout the proposed implementation here: https://mathiasbynens.be/notes/globalthis we can't use it: it creates a polyfill, not a ponyfill.\nHowever I took a line from the \"naive implementation\".\n","publish_time":1648886010756,"_cnpm_publish_time":1648886010756,"dist-tags":{"latest":"4.0.0"}}