polyfill-library-node

1.1.0 • Public • Published

polyfill-library-node

npm

An alternative to core-js for nodeJS environments.

Loads all ECMAScript-262 (excluding annex-B) polyfills into nodeJS.

You should use this if you are wanting to use the latest stable features of JavaScript but the version of nodeJS you are using does not have those features.

Install

$ npm install polyfill-library-node

Usage

require("polyfill-library-node");

// Now nodeJS has all stable JavaScript features such as Array.prototype.flatMap, Promise.allSettled etc

FAQ

How come it does not support proposal "X" ?

polyfill-library follows the guidance from the W3C TAG on polyfilling and only implements polyfills features/proposals of ECMAScript that have reached stage 4 whereas core-js implements polyfills for proposals at all stages.

How come it does not make async-await functions, for-of loops etc work in old versions of nodeJS ?

Those features are new pieces of syntax and not a standard built-in object, and JavaScript does not have a way to make the runtime (in this case nodeJS) understand new pieces of syntax. It is only possible to polyfill standard built-in objects. If you are wanting to use new syntax in a version of nodeJS which does not support it, you will need to use a compiler such as Babel and Babel's nodeJS CLI.

Package Sidebar

Install

npm i polyfill-library-node

Weekly Downloads

5

Version

1.1.0

License

MIT

Unpacked Size

110 kB

Total Files

20

Last publish

Collaborators

  • the-ft