Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
core-js-compat
Advanced tools
The core-js-compat package provides compatibility data for core-js, which is a modular standard library for JavaScript, including polyfills for ECMAScript up to the latest standards. It is useful for developers who need to know which features are available in core-js for a specific version of a browser or Node.js.
Compatibility Data Retrieval
Retrieve a list of features supported by core-js for a specific environment, such as Chrome 70.
const { list } = require('core-js-compat')({ targets: 'chrome 70' });
Custom Build Generation
Generate a list of core-js modules required to support a specific target, such as Internet Explorer 11, with a specific version of core-js.
const { getModulesListForTargetVersion } = require('core-js-compat');
const modulesList = getModulesListForTargetVersion({ targets: { ie: 11 }, version: '3.6' });
Babel-polyfill is a package that includes Babel transforms and a polyfill that includes a custom regenerator runtime and core-js. It is similar to core-js-compat in that it provides polyfills for ECMAScript features, but it is less modular and is deprecated in favor of directly including core-js and regenerator-runtime.
The es6-shim package provides polyfills for ECMAScript 6 (also known as ECMAScript 2015) features. It is similar to core-js-compat in providing polyfills, but it is focused only on ES6 features and does not provide the modular approach or the compatibility data that core-js-compat offers.
The polyfill-service package by Financial Times provides a service that returns a set of polyfills based on the user-agent string of the browser making the request. It is similar to core-js-compat in that it aims to provide polyfills for compatibility, but it does so as a service rather than a package to include in your project.
core-js-compat
package contains data about the necessity of core-js
modules and API for getting a list of required core-js modules by browserslist query.
import compat from 'core-js-compat';
const {
list, // array of required modules
targets, // object with targets for each module
} = compat({
targets: '> 1%', // browserslist query or object of minimum environment versions to support, see below
modules: [ // optional list / filter of modules - regex, string or an array of them:
'core-js/actual', // - an entry point
'esnext.array.unique-by', // - a module name (or just a start of a module name)
/^web\./, // - regex that a module name must satisfy
],
exclude: [ // optional list / filter of modules to exclude, the signature is similar to `modules` option
'web.atob',
],
version: '3.40', // used `core-js` version, by default - the latest
inverse: false, // inverse of the result - shows modules that are NOT required for the target environment
});
console.log(targets);
/* =>
{
'es.error.cause': { ios: '14.5-14.8' },
'es.aggregate-error.cause': { ios: '14.5-14.8' },
'es.array.at': { ios: '14.5-14.8' },
'es.array.find-last': { firefox: '100', ios: '14.5-14.8' },
'es.array.find-last-index': { firefox: '100', ios: '14.5-14.8' },
'es.array.includes': { firefox: '100' },
'es.array.push': { chrome: '100', edge: '101', ios: '14.5-14.8', safari: '15.4' },
'es.array.unshift': { ios: '14.5-14.8', safari: '15.4' },
'es.object.has-own': { ios: '14.5-14.8' },
'es.regexp.flags': { chrome: '100', edge: '101' },
'es.string.at-alternative': { ios: '14.5-14.8' },
'es.typed-array.at': { ios: '14.5-14.8' },
'es.typed-array.find-last': { firefox: '100', ios: '14.5-14.8' },
'es.typed-array.find-last-index': { firefox: '100', ios: '14.5-14.8' },
'esnext.array.group': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.array.group-by': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.array.group-by-to-map': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.array.group-to-map': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.array.to-reversed': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.array.to-sorted': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.array.to-spliced': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.array.unique-by': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.array.with': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.typed-array.to-reversed': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.typed-array.to-sorted': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.typed-array.to-spliced': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'esnext.typed-array.with': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'web.dom-exception.stack': { chrome: '100', edge: '101', ios: '14.5-14.8', safari: '15.4' },
'web.immediate': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' },
'web.structured-clone': { chrome: '100', edge: '101', firefox: '100', ios: '14.5-14.8', safari: '15.4' }
}
*/
targets
optiontargets
could be a browserslist
query or a targets object that specifies minimum environment versions to support:
// browserslist query:
'defaults, not IE 11, maintained node versions';
// object (sure, all those fields optional):
({
android: '4.0', // Android WebView version
bun: '0.1.2', // Bun version
chrome: '38', // Chrome version
'chrome-android': '18', // Chrome for Android version
deno: '1.12', // Deno version
edge: '13', // Edge version
electron: '5.0', // Electron framework version
firefox: '15', // Firefox version
'firefox-android': '4', // Firefox for Android version
hermes: '0.11', // Hermes version
ie: '8', // Internet Explorer version
ios: '13.0', // iOS Safari version
node: 'current', // NodeJS version, you can use 'current' for set it to currently used
opera: '12', // Opera version
'opera-android': '7', // Opera for Android version
phantom: '1.9', // PhantomJS headless browser version
quest: '5.0', // Meta Quest Browser version
'react-native': '0.70', // React Native version (default Hermes engine)
rhino: '1.7.13', // Rhino engine version
safari: '14.0', // Safari version
samsung: '14.0', // Samsung Internet version
esmodules: true, // That option set target to minimum supporting ES Modules versions of all browsers
browsers: '> 0.25%', // Browserslist query or object with target browsers
});
// equals of of the method from the example above
require('core-js-compat/compat')({ targets, modules, version }); // => { list: Array<ModuleName>, targets: { [ModuleName]: { [EngineName]: EngineVersion } } }
// or
require('core-js-compat').compat({ targets, modules, version }); // => { list: Array<ModuleName>, targets: { [ModuleName]: { [EngineName]: EngineVersion } } }
// full compat data:
require('core-js-compat/data'); // => { [ModuleName]: { [EngineName]: EngineVersion } }
// or
require('core-js-compat').data; // => { [ModuleName]: { [EngineName]: EngineVersion } }
// map of modules by `core-js` entry points:
require('core-js-compat/entries'); // => { [EntryPoint]: Array<ModuleName> }
// or
require('core-js-compat').entries; // => { [EntryPoint]: Array<ModuleName> }
// full list of modules:
require('core-js-compat/modules'); // => Array<ModuleName>
// or
require('core-js-compat').modules; // => Array<ModuleName>
// the subset of modules which available in the passed `core-js` version:
require('core-js-compat/get-modules-list-for-target-version')('3.40'); // => Array<ModuleName>
// or
require('core-js-compat').getModulesListForTargetVersion('3.40'); // => Array<ModuleName>
If you wanna help to improve this data, you could take a look at the related section of CONTRIBUTING.md
. The visualization of compatibility data and the browser tests runner is available here, the example:
Error.isError
stage 3 proposal:
Error.isError
.sham
Iterator
sequencing stage 2.7 proposal:
IteratorResult
objects when possible, tc39/proposal-iterator-sequencing/17, tc39/proposal-iterator-sequencing/18, December 2024 TC39 meetingSet
methodsDataView.prototype.{ getFloat16, setFloat16 }
performance, #1379, thanks @LeviPesin%TypedArray%.prototype.toSpliced
Math.scale
) available on globalRegExp.escape
marked as shipped from Safari 18.2Promise.try
marked as shipped from Safari 18.2Math.f16round
and DataView.prototype.{ getFloat16, setFloat16 }
marked as shipped from Safari 18.2Uint8Array
to / from base64 and hex proposal methods marked as shipped from Safari 18.2JSON.parse
source text access proposal features marked as shipped from FF135RegExp.escape
marked as shipped from FF134Promise.try
marked as shipped from FF134Symbol.dispose
, Symbol.asyncDispose
and Iterator.prototype[@@dispose]
marked as shipped from FF135JSON.parse
source text access proposal features marked as shipped from Bun 1.1.43URL.parse
was added - 22.1 instead of 22.0FAQs
core-js compat
The npm package core-js-compat receives a total of 24,531,445 weekly downloads. As such, core-js-compat popularity was classified as popular.
We found that core-js-compat 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
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.