{"name":"@offirmo/globalthis-ponyfill","description":"Ponyfill for globalThis","version":"4.0.0","author":{"name":"Offirmo","email":"offirmo.net@gmail.com"},"license":"Unlicense","sideEffects":false,"exports":{".":{"import":"./dist/src.es2022/index.js","require":"./dist/src.es2022.cjs/index.js"}},"module":"dist/src.es2022/index.js","main":"dist/src.es2022.cjs/index.js","typings":"dist/src.es2022.cjs/index.d.ts","source":"src/index.ts","size-limit":[{"limit":"200B","path":"dist/src.es2022/index.js"},{"limit":"300B","path":"dist/src.es2022.cjs/index.js"}],"peerDependencies":{},"dependencies":{},"scripts":{"clean":"monorepo-script--clean-package …dist","_build:dev:watch":"monorepo-script--build-typescript-package --watch","_build:prod":"monorepo-script--build-typescript-package","ensure-size":"size-limit","dev":"run-s clean _build:dev:watch","test":"mocha --bail --config ../../node_modules/@offirmo/unit-test-toolbox/mocharc.json --file ../../node_modules/@offirmo/unit-test-toolbox/mocha-chai-init-node.cjs 'dist/src.es2022.cjs/**/*spec.js'","build":"run-s  clean _build:prod","prepublishOnly":"run-s build ensure-size"},"devDependencies":{"@offirmo-private/monorepo-scripts":"*","@offirmo/unit-test-toolbox":"^8","@size-limit/preset-small-lib":"^8","npm-run-all":"^4","size-limit":"^8"},"repository":{"type":"git","url":"git+https://github.com/Offirmo/offirmo-monorepo--2022.git#main"},"keywords":["globalThis","ponyfill","typescript"],"homepage":"https://github.com/Offirmo/offirmo-monorepo--2022/tree/main/stack--2022/1-stdlib/globalthis-ponyfill","bugs":{"url":"https://github.com/Offirmo/offirmo-monorepo/issues"},"gitHead":"a55d271a5c9faa1150b4e074d4006e11f9dd2986","_id":"@offirmo/globalthis-ponyfill@4.0.0","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-1KxKgU8b1Nm0EKsIwnwEmAtt8Y3eC/wUqyFjDu3cKKqyhc2mH6lRGwB4Oc3KWYSs9ejyvbDyhM/H9c+rpexkww==","shasum":"b7a64568a5f4c2277bbb3a950f9eced6abb8c77c","tarball":"http://registry-npm.ywwl.com/@offirmo/globalthis-ponyfill/download/@offirmo/globalthis-ponyfill-4.0.0.tgz","fileCount":20,"unpackedSize":18458,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1sqgGaMIn6K2AsRVAjcQTkIVwrlq01iHvZmk2j+dZ+gIgYVadMNoz1BXmRoQGFe4wGJxQKVCzwDMB4/F7Pb8r3mg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjmhCXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoHQg//VtL64G9JJykU64LOeNJSsiXaAewOYIYjpPYJadYJnyt1GItF\r\n0mvFO5LU4YIKW6QNEXNPn7fCyTtxedb47fuyo+dN+EjkjNcxTPX8mmHMuNy5\r\nPt22UdRkK5ucMa9HG2up/fOtWQ1guBvtxoysDmoJfRlrZKqkR4kaxJapjE8E\r\nOQb3eYu/2PvQM4Y/vUWpICG8NJlCap+Z1K5e50I8RZ5sTHRRXa7QnDzQ/9wX\r\nUoAISiEuzMvmI3M5toG2WX5+vGAKDvft6MYakixp+RuHnMjISXSYKN5M3OhB\r\nH/aVlGQzSalY/Ina+pezTJGof8EvK6+o/a6qu2a4aLeNWX5wl4u/D7ROpg9Z\r\nf0wPDv2tIECw3cwWBa+AIjczoVC9CT3hM1hE+elhTpwsF61WKqd2ATzUZSOs\r\nN1T4FLBjKw4z4rqiUQAWiE1hwZHfudgu6mqfdz6YuH0WkwW5XOMs+IxV0tux\r\nJBjCEA8pgyxH4C741WNZMuMV3NuMo68OOPGhoyW5mwo+L+y9pvBQRH44ZNZ8\r\nZxCpSW7qoUCNFB3oNREDqp22Uq5V+ksEVgRYOn+IYQ4aTRVDW7LNmxItZPXW\r\nb2QQeOXOIiTHu50nr9+wJLpngGNxVZyHH8jUMLm5J8nby9oNepojkQm7weT2\r\n4EG1O1QXdlsbce+ZTWzsOXqrWb5n9Qep5po=\r\n=x6FA\r\n-----END PGP SIGNATURE-----\r\n","size":4310,"noattachment":false,"key":"/@offirmo/globalthis-ponyfill/-/@offirmo/globalthis-ponyfill-4.0.0.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_4.0.0_1671041174833_0.4406050484349249"},"_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":1671041175033,"_cnpm_publish_time":1671041175033,"dist-tags":{"latest":"4.0.0"}}