{"id":15678637,"url":"https://github.com/garronej/minimal_polyfills","last_synced_at":"2025-04-13T18:34:13.394Z","repository":{"id":40723628,"uuid":"195527039","full_name":"garronej/minimal_polyfills","owner":"garronej","description":"🎯An ultra light-weight, nonexhaustive, polyfills library 🎯","archived":false,"fork":false,"pushed_at":"2024-05-03T10:23:59.000Z","size":129,"stargazers_count":6,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T03:48:23.431Z","etag":null,"topics":["lightweight","map","polyfills","set","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garronej.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-06T10:29:13.000Z","updated_at":"2024-05-03T10:24:02.000Z","dependencies_parsed_at":"2024-05-03T11:48:24.102Z","dependency_job_id":"592cb0aa-7830-46d3-b817-13e07dbd5e00","html_url":"https://github.com/garronej/minimal_polyfills","commit_stats":{"total_commits":70,"total_committers":3,"mean_commits":"23.333333333333332","dds":0.2142857142857143,"last_synced_commit":"de8ebe43c2dcc615a0c5fc24fb171a254f123e12"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garronej%2Fminimal_polyfills","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garronej%2Fminimal_polyfills/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garronej%2Fminimal_polyfills/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garronej%2Fminimal_polyfills/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garronej","download_url":"https://codeload.github.com/garronej/minimal_polyfills/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248760670,"owners_count":21157407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lightweight","map","polyfills","set","typescript"],"created_at":"2024-10-03T16:23:39.082Z","updated_at":"2025-04-13T18:34:13.372Z","avatar_url":"https://github.com/garronej.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/6702424/74083910-7305c180-4a69-11ea-9595-331c7976c292.png\"\u003e  \n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ci\u003e 🎯A collection of polyfills that focuses on being ultra light-weight 🎯 \u003c/i\u003e\n    \u003cbr\u003e\n    \u003cbr\u003e\n    \u003cimg src=\"https://github.com/garronej/minimal_polyfills/workflows/ci/badge.svg?branch=develop\"\u003e\n    \u003cimg src=\"https://img.shields.io/bundlephobia/minzip/minimal-polyfills\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/l/minimal-polyfills\"\u003e\n\u003c/p\u003e\n\n---\n\nSet of polyfills for ``Map``, ``Set``, ``WeakMap`` and other standard functions that could be missing in some legacy runtime environnement.\nFocus is placed on bundle size rather than performance and transparency.  \nThe 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.  \nThe 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.\nAs you would expect the polyfills will only be used when the native classes are missing.\n\n# Usage\n\n## Example with Map\n\n```typescript\n//Example with map.\nimport { Polyfill as Map, LightMap } from \"minimal-polyfills/Map\";\n\n// Explicitly define the type of your variable to make it clear\n// that you are using a subset of Map...\nconst map: LightMap\u003cstring, number\u003e= new Map();\n//...or let the type be inferred.\nconst map = new Map\u003cstring, number\u003e();\n```\n\n![Screenshot 2020-02-08 at 10 45 06](https://user-images.githubusercontent.com/6702424/82556081-564d4f80-9b69-11ea-9b62-46eaa910a2e3.png)\n![Screenshot 2020-02-08 at 10 46 34](https://user-images.githubusercontent.com/6702424/82556246-a5938000-9b69-11ea-8b3f-6a6036288ba1.png)\n\n## Others data structures: \n\n```typescript\nimport { Polyfill as Set, LightSet } from \"minimal-polyfills/Set\";\n//WARNING: If not natively supported WeakMap will only be a simple Map that will keep string references of it's keys.\nimport { Polyfill as WeakMap } from \"minimal-polyfills/WeakMap\";\nimport { Polyfill as WeakSet } from \"minimal-polyfills/WeakSet\";\n```\n\n## Common missing features on older browsers:\n\n```typescript\nimport \"minimal-polyfills/Array.prototype.find\";\nimport \"minimal-polyfills/String.prototype.startsWith.ts\";\nimport \"minimal-polyfills/Array.from.ts\";\nimport \"minimal-polyfills/ArrayBuffer.isView.ts\";\nimport \"minimal-polyfills/Object.fromEntries\";\nimport \"minimal-polyfills/Object.is.ts\";\nimport \"minimal-polyfills/Object.assign.ts\";\n```\n\n# Try it now\n\nThanks to Stackblitz you can try this lib with within your browser like if you where in VSCode. \n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/6702424/82556457-0622bd00-9b6a-11ea-8056-5a9c31a4ba39.png\"\u003e  \n\u003c/p\u003e\n\n[__Run the example__](https://stackblitz.com/edit/minimal-polyfills-demo?embed=1\u0026file=index.ts)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarronej%2Fminimal_polyfills","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarronej%2Fminimal_polyfills","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarronej%2Fminimal_polyfills/lists"}