Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@offirmo/globalthis-ponyfill

3.0.0 • Public • Published

globalThis ponyfill
Offirmo’s quality seal

npm badge dependencies badge bundle size badge license badge maintenance status badge

This is a trivial TypeScript-compatible globalThis ponyfill.

  • very small minzipped size
  • NO dependencies
  • doesn't alter the environment
  • compatible node & browser

Usage

import { getGlobalThis } from '@offirmo/globalthis-ponyfill'
 
const globalThis = getGlobalThis()

Rationale

There are existing ponyfills/polyfills out there, but they didn't work for me:

  • mine is much simpler: a single TS file of 6 meaningful lines
  • I needed TypeScript

Credits

YES I had a look at ljharb/globalThis's implementation (MIT) and started my implementation from it! Thanks a lot and all credits due!

About the proposed implementation here: https://mathiasbynens.be/notes/globalthis we can't use it: it creates a polyfill, not a ponyfill. However I took a line from the "naive implementation".

Install

npm i @offirmo/globalthis-ponyfill

DownloadsWeekly Downloads

4

Version

3.0.0

License

Unlicense

Unpacked Size

8.9 kB

Total Files

10

Last publish

Collaborators

  • avatar