🎯An ultra light-weight, nonexhaustive, type safe, polyfills library for common data structures.🎯
Set of polyfills for allowing usage of common data structures on older browsers ( Map, Set, WeakMap ).
Focus is placed on bundle size rather than performance and transparency.
The goal is to allow our code to run on older browsers without significantly increasing the bundle size by adding exhaustive polyfills that in 95% of the cases won't be necessary.
The classes exposed only implement the more common features of their native counterpart, it does so in a very naïve and inefficient way to keep the code as short as possible.
As you would expect the polyfills will only be used when the native classes are missing.
Usage
Example with Map
import { Polyfill as Map, LightMap } from "minimal-polyfills/dist/lib/Map";
const map: LightMap<string, number>= new Map();
const map = new Map<string, number>();
Others data structures:
import { Polyfill as Set, LightSet } from "minimal-polyfills/dist/lib/Set";
import { Polyfill as WeakMap } from "minimal-polyfills/dist/lib/WeakMap";
Common missing features on older browsers:
import "minimal-polyfills/dist/lib/Array.prototype.find";
import "minimal-polyfills/dist/lib/String.prototype.startsWith.ts";
import "minimal-polyfills/dist/lib/Array.from.ts";
import "minimal-polyfills/dist/lib/ArrayBuffer.isView.ts";