{"name":"@offirmo/globalthis-ponyfill","description":"Ponyfill for globalThis","version":"1.0.1","author":{"name":"Offirmo","email":"offirmo.net@gmail.com"},"license":"Unlicense","esnext":"dist/src.es9/index.js","module":"dist/src.es9/index.js","main":"dist/src.es9.cjs/index.js","typings":"dist/src.es9.cjs/index.d.ts","source":"src/index.ts","sideEffects":false,"size-limit":[{"limit":"200B","path":"dist/src.es9/index.js"},{"limit":"200B","path":"dist/src.es9.cjs/index.js"}],"peerDependencies":{},"dependencies":{},"devDependencies":{"np":"^5","npm-run-all":"^4","size-limit":"^1"},"scripts":{"clean":"node ../../scripts/clean.js dist","build:dev:watch":"node ../../scripts/build-typescript.js --watch","build:prod":"node ../../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"},"repository":{"type":"git","url":"git+https://github.com/Offirmo/offirmo-monorepo.git"},"keywords":["globalThis","ponyfill","typescript"],"homepage":"https://github.com/Offirmo/offirmo-monorepo/tree/master/1-foundation/globalthis-ponyfill","bugs":{"url":"https://github.com/Offirmo/offirmo-monorepo/issues"},"_id":"@offirmo/globalthis-ponyfill@1.0.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-WkowumyxOzVIete2kD5nydFVbJYFbzIR8c7ZB/I60EIVZja9TbRbyXTo4Ba5kVJlW7PVZlphCNk1+mzE91roqA==","shasum":"99e2e6de473ab0289045335ea2f21017f35ee170","tarball":"http://registry-npm.ywwl.com/@offirmo/globalthis-ponyfill/download/@offirmo/globalthis-ponyfill-1.0.1.tgz","fileCount":10,"unpackedSize":7994,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdGIkECRA9TVsSAnZWagAAwmwQAJ4ArFaqsls/EErbMf4D\n4lIKWfkwyGj9q98mgpQ9gkIZSfK7fC5M8M+3T+nsaejrZRmdqsOOZnrpAFNU\nkacQi4NSaVBq23GPiGV0Isk6xzt7oUIPKIG9+S6Ffy2ACtDQtqauLEJ1Ce7F\nDSdvHXH3VazNsumYZOkJrD7rtss5YaPpkgCdRVzq4cs/C5hUJgdnwHsE8W52\niw6WhwmzSDho6m6B9p7sifTjxiZ8b6aKRf+2gcwFKCKK/u+DUva8Y8CvAHzk\nNo/89m4u2kMSmG7lm/gWnFP9gF81p9Y4+uOo2gmzLZwNmWxWSN3w6oI6nH4g\nqISEbo02SUBvwt2ndzAEHGccOPr6BZ8fX2XlCIIQMUARvuU0Rvg8YC/H0tTN\nNn4peUOz7QMGC1Dn4CXoqMkYX5IV6T031Fp3mvY/DWqIzo33KM0+j8/anvWU\nUMU2yfAZxZZxfgSP/vVVa4NCIp2boPL9/npK1DYf2LU8OGV5gOrYlGF984Ra\nWbqmSAG53/hf9ysMEnH+1msiW7oMdlFe+viIUlLhfUpX13C3+VuhSnMIkwO9\nCZ6QPM4PWdHoui4IYfdDJP2sFLL9OugI15f4GqISCfE7LFxZvbh9OuXpn6wB\nD88ygD5Ife4+SgWMsnTui3t3XkWpk/0cTgcd7yBLxuSPL4gxGHuMunV5iJew\nQNsd\r\n=0tPD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0HE9pCj17Rzm/x5lZd9pLFbz3jO4EwxM/CcwUS7FdqQIgCB6dUQFdzR6mIc4CFVhuwW3gUAQ2Ch9kZW6cN4URcYI="}],"size":2864,"noattachment":false,"key":"/@offirmo/globalthis-ponyfill/-/@offirmo/globalthis-ponyfill-1.0.1.tgz"},"maintainers":[{"name":"offirmo","email":"offirmo.net@gmail.com"}],"_npmUser":{"name":"offirmo","email":"offirmo.net@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/globalthis-ponyfill_1.0.1_1561889027636_0.6149554689070165"},"_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":1561889027759,"_cnpm_publish_time":1561889027759,"dist-tags":{"latest":"4.0.0"}}