ungap

Modern Web development one jump at the time

jumping the gap Photo by Denny Luan on Unsplash

About

The ungap project was born after years of attempts to always fix the same issue, but never in a modular way and, most importantly, never in a single, 100% code covered, organization.

Focused on size, compatibility, and quality

Each module is written in ES5 compatible syntax to avoid both unnecessary transpilers bloat and potentially unexpected behaviors. Each module is also 100% code-covered through tests able to verify the whole API both as native and polyfilled version. The constrains per module are the following:

[1] as example: stripped out features detections

Pragmatic is better than (im)perfect

There are parts of the specifications that are very hard, if not impossible, to polyfill. The main purpose of this project is to help developers move forward, and possibly without unnecessary bloat. This basically means that polyfills are written to support 99% of the use cases, without granting 100% spec compliance.

If you need that, which again is basically impossible in most of the cases, feel free to keep using whatever monolithic polyfill or approach you were using before.

How to use a module

Every single module is made available as ESM, through the package.json's module field, CJS via package.json's main field, and browser script polyfill / patch via package.json's unpkg field so that you can use directly the unpkg CDN.

// as ECMAScript module
import WeakSet from '@ungap/weakset';

// as CommonJS module
const WeakSet = require('@ungap/weakset');

// as Browser global patch
<script src="https://unpkg.com/@ungap/weakset"></script>

Essential polyfills

Essentials modules covers most common use cases without going full bloated API. As example, the essential-map exposes only get, set, delete, and has which is most of the time everything one needs, as opposite of going full map. The main benefit of the essential modules is their size, simplicity, or even performance.

Regular polyfills

Polyfilled utilities

Ungap utilities are meant to simplify cross browser development without the bloat of a whole polyfill.

Plugins to remove unnecessary bloat

If you are targeting modern browsers only, you might want to exclude some unnecessary code from various ungapped APIs.

Following a list of plugins which aim is to address those cases:

License

Each module is under the npm default ISC license.

How to contribute

You are welcome to join the organization after your first module is published.

In order to do so, please take any already available module as example of how to create and test any code you need.

The main guideline though, can be summarized as such:

I have personally no interest in enforcing any specific linting rule or code style, as long as common sense and good practices are part of the code.

If these basic constrains are good enough for you, please do help this project grow, allowing the community to leave all monolithic polyfills part of the past.

If you have further questions, you can DM me @webreflection [1]

[1] my DMs are open