Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
The core-js npm package is a modular standard library for JavaScript, which includes polyfills for ECMAScript features. It provides reliable polyfills to ensure that code behaves consistently across different environments, including older browsers.
Polyfilling ECMAScript features
This feature allows developers to use the latest ECMAScript features while ensuring backward compatibility with older environments that do not support these features natively.
require('core-js/stable');
// Now you can use ES6 features like Promise in environments that do not support them natively.
Polyfilling Web Standards
Core-js can also polyfill web standards, allowing developers to use modern web APIs in environments that have not implemented them.
require('core-js/web');
// This includes polyfills for web standards like DOM collections (e.g., NodeList), timers, and more.
Polyfilling Proposals
Developers can experiment with proposed ECMAScript features before they are finalized and adopted into the standard, ensuring forward compatibility.
require('core-js/proposals');
// This will include polyfills for ECMAScript proposals that are not yet part of the standard.
Babel-polyfill is a package that provides polyfills necessary for a full ES2015+ environment. It is similar to core-js but is more tightly coupled with Babel's transpilation process.
The es6-shim package provides polyfills for ECMAScript 6 (aka ECMAScript 2015) features. It is similar to core-js but focuses specifically on ES6 features and does not cover proposals or web standards.
The polyfill-service by Financial Times is an online service that provides polyfills based on the user's browser. It is different from core-js in that it is a service rather than a package you include in your project, but it serves a similar purpose in polyfilling features.
Become a sponsor and get your logo with a link to your site on our README on GitHub and NPM.
Become a sponsor and get your logo with a link to your site on our README on GitHub and NPM.
Modular standard library for JavaScript. Includes polyfills for ECMAScript up to 2019: promises, symbols, collections, iterators, typed arrays, many other features, ECMAScript proposals, some cross-platform WHATWG / W3C features and proposals like URL
. You can load only required features or use it without global namespace pollution.
import 'core-js'; // <- at the top of your entry point
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
[1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32
You can load only required features:
import 'core-js/features/array/from'; // <- at the top of your entry point
import 'core-js/features/array/flat'; // <- at the top of your entry point
import 'core-js/features/set'; // <- at the top of your entry point
import 'core-js/features/promise'; // <- at the top of your entry point
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
[1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32
Or use it without global namespace pollution:
import from from 'core-js-pure/features/array/from';
import flat from 'core-js-pure/features/array/flat';
import Set from 'core-js-pure/features/set';
import Promise from 'core-js-pure/features/promise';
from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
flat([1, [2, 3], [4, [5]]], 2); // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32
It's a global version (first 2 examples), for more info see core-js
documentation.
FAQs
Standard library
The npm package core-js receives a total of 14,987,800 weekly downloads. As such, core-js popularity was classified as popular.
We found that core-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.