core-js-compat
core-js compat
Last updated 2 years ago by zloirock .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install core-js-compat 
SYNC missed versions from official npm registry.

logo

fundraising PRs welcome version core-js-compat downloads

I highly recommend reading this: So, what's next?

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.37',            // 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 option

targets 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
}

Additional API:

// 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.37'); // => Array<ModuleName>
// or
require('core-js-compat').getModulesListForTargetVersion('3.37'); // => 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:

compat-table

Current Tags

  • 3.0.0-beta.20                                ...           beta (6 years ago)
  • 3.39.0                                ...           latest (15 days ago)

143 Versions

  • 3.39.0                                ...           15 days ago
  • 3.38.1                                ...           3 months ago
  • 3.38.0                                ...           3 months ago
  • 3.37.1                                ...           6 months ago
  • 3.37.0                                ...           7 months ago
  • 3.36.1                                ...           8 months ago
  • 3.36.0                                ...           9 months ago
  • 3.35.1                                ...           10 months ago
  • 3.35.0                                ...           a year ago
  • 3.34.0                                ...           a year ago
  • 3.33.3                                ...           a year ago
  • 3.33.2                                ...           a year ago
  • 3.33.1                                ...           a year ago
  • 3.33.0                                ...           a year ago
  • 3.32.2                                ...           a year ago
  • 3.32.1                                ...           a year ago
  • 3.32.0                                ...           a year ago
  • 3.31.1                                ...           a year ago
  • 3.31.0                                ...           a year ago
  • 3.30.2                                ...           2 years ago
  • 3.30.1                                ...           2 years ago
  • 3.30.0                                ...           2 years ago
  • 3.29.1                                ...           2 years ago
  • 3.29.0                                ...           2 years ago
  • 3.28.0                                ...           2 years ago
  • 3.27.2                                ...           2 years ago
  • 3.27.1                                ...           2 years ago
  • 3.27.0                                ...           2 years ago
  • 3.26.1                                ...           2 years ago
  • 3.26.0                                ...           2 years ago
  • 3.25.5                                ...           2 years ago
  • 3.25.4                                ...           2 years ago
  • 3.25.3                                ...           2 years ago
  • 3.25.2                                ...           2 years ago
  • 3.25.1                                ...           2 years ago
  • 3.25.0                                ...           2 years ago
  • 3.24.1                                ...           2 years ago
  • 3.24.0                                ...           2 years ago
  • 3.23.5                                ...           2 years ago
  • 3.23.4                                ...           2 years ago
  • 3.23.3                                ...           2 years ago
  • 3.23.2                                ...           2 years ago
  • 3.23.1                                ...           2 years ago
  • 3.23.0                                ...           2 years ago
  • 3.22.8                                ...           2 years ago
  • 3.22.7                                ...           2 years ago
  • 3.22.6                                ...           2 years ago
  • 3.22.5                                ...           3 years ago
  • 3.22.4                                ...           3 years ago
  • 3.22.3                                ...           3 years ago
  • 3.22.2                                ...           3 years ago
  • 3.22.1                                ...           3 years ago
  • 3.22.0                                ...           3 years ago
  • 3.21.1                                ...           3 years ago
  • 3.21.0                                ...           3 years ago
  • 3.20.3                                ...           3 years ago
  • 3.20.2                                ...           3 years ago
  • 3.20.1                                ...           3 years ago
  • 3.20.0                                ...           3 years ago
  • 3.19.3                                ...           3 years ago
  • 3.19.2                                ...           3 years ago
  • 3.19.1                                ...           3 years ago
  • 3.19.0                                ...           3 years ago
  • 3.18.3                                ...           3 years ago
  • 3.18.2                                ...           3 years ago
  • 3.18.1                                ...           3 years ago
  • 3.18.0                                ...           3 years ago
  • 3.17.3                                ...           3 years ago
  • 3.17.2                                ...           3 years ago
  • 3.17.1                                ...           3 years ago
  • 3.17.0                                ...           3 years ago
  • 3.16.4                                ...           3 years ago
  • 3.16.3                                ...           3 years ago
  • 3.16.2                                ...           3 years ago
  • 3.16.1                                ...           3 years ago
  • 3.16.0                                ...           3 years ago
  • 3.15.2                                ...           3 years ago
  • 3.15.1                                ...           3 years ago
  • 3.15.0                                ...           3 years ago
  • 3.14.0                                ...           3 years ago
  • 3.13.1                                ...           3 years ago
  • 3.13.0                                ...           3 years ago
  • 3.12.1                                ...           4 years ago
  • 3.12.0                                ...           4 years ago
  • 3.11.3                                ...           4 years ago
  • 3.11.2                                ...           4 years ago
  • 3.11.1                                ...           4 years ago
  • 3.11.0                                ...           4 years ago
  • 3.10.2                                ...           4 years ago
  • 3.10.1                                ...           4 years ago
  • 3.10.0                                ...           4 years ago
  • 3.9.1                                ...           4 years ago
  • 3.9.0                                ...           4 years ago
  • 3.8.3                                ...           4 years ago
  • 3.8.2                                ...           4 years ago
  • 3.8.1                                ...           4 years ago
  • 3.8.0                                ...           4 years ago
  • 3.7.0                                ...           4 years ago
  • 3.6.5                                ...           5 years ago
  • 3.6.4                                ...           5 years ago
  • 3.6.3                                ...           5 years ago
  • 3.6.2                                ...           5 years ago
  • 3.6.1                                ...           5 years ago
  • 3.6.0                                ...           5 years ago
  • 3.5.0                                ...           5 years ago
  • 3.4.8                                ...           5 years ago
  • 3.4.7                                ...           5 years ago
  • 3.4.5                                ...           5 years ago
  • 3.4.4                                ...           5 years ago
  • 3.4.3                                ...           5 years ago
  • 3.4.2                                ...           5 years ago
  • 3.4.1                                ...           5 years ago
  • 3.4.0                                ...           5 years ago
  • 3.3.6                                ...           5 years ago
  • 3.3.5                                ...           5 years ago
  • 3.3.4                                ...           5 years ago
  • 3.3.3                                ...           5 years ago
  • 3.3.2                                ...           5 years ago
  • 3.3.1                                ...           5 years ago
  • 3.2.1                                ...           5 years ago
  • 3.2.0                                ...           5 years ago
  • 3.1.4                                ...           5 years ago
  • 3.1.3                                ...           5 years ago
  • 3.1.2                                ...           5 years ago
  • 3.1.1                                ...           5 years ago
  • 3.1.0                                ...           5 years ago
  • 3.0.1                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 3.0.0-beta.20                                ...           6 years ago
  • 3.0.0-beta.19                                ...           6 years ago
  • 3.0.0-beta.18                                ...           6 years ago
  • 3.0.0-beta.17                                ...           6 years ago
  • 3.0.0-beta.16                                ...           6 years ago
  • 3.0.0-beta.15                                ...           6 years ago
  • 3.0.0-beta.14                                ...           6 years ago
  • 3.0.0-beta.13                                ...           6 years ago
  • 3.0.0-beta.12                                ...           6 years ago
  • 3.0.0-beta.11                                ...           6 years ago
  • 3.0.0-beta.10                                ...           6 years ago
  • 3.0.0-beta.9                                ...           6 years ago
  • 3.0.0-beta.8                                ...           6 years ago
  • 3.0.0-beta.7                                ...           6 years ago
  • 3.0.0-beta.6                                ...           6 years ago
Maintainers (1)
Downloads
Total 3
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE