Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
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.
const {
list, // array of required modules
targets, // object with targets for each module
} = require('core-js-compat')({
targets: '> 2.5%', // browserslist query
filter: 'es.', // optional filter - string-prefix, regexp or list of modules
});
console.log(targets);
/* =>
{
'es.symbol.description': { ios: '12.0-12.1' },
'es.array.reverse': { ios: '12.0-12.1' },
'es.string.replace': { firefox: '63', ios: '12.0-12.1' },
'es.string.trim': { ios: '12.0-12.1' },
'es.promise': { firefox: '63' },
'es.promise.finally': { firefox: '63' },
'es.array-buffer.slice': { ios: '12.0-12.1' },
'es.typed-array.int8-array': { ios: '12.0-12.1' },
'es.typed-array.uint8-array': { ios: '12.0-12.1' },
'es.typed-array.uint8-clamped-array': { ios: '12.0-12.1' },
'es.typed-array.int16-array': { ios: '12.0-12.1' },
'es.typed-array.uint16-array': { ios: '12.0-12.1' },
'es.typed-array.int32-array': { ios: '12.0-12.1' },
'es.typed-array.uint32-array': { ios: '12.0-12.1' },
'es.typed-array.float32-array': { ios: '12.0-12.1' },
'es.typed-array.float64-array': { ios: '12.0-12.1' },
'es.typed-array.from': { ios: '12.0-12.1' },
'es.typed-array.of': { ios: '12.0-12.1' }
}
*/
If you want to add new / update data about modules required for target engines, follow this instruction.
Object.fromEntries
(ECMAScript 2019)Symbol#description
(ECMAScript 2019)Set
methods (stage 2 proposal)
Set#difference
Set#intersection
Set#isDisjointFrom
Set#isSubsetOf
Set#isSupersetOf
Set#symmetricDifference
Set#union
Promise.allSettled
(stage 2 proposal)Array
(stage 1 proposal)
Array#lastItem
Array#lastIndex
String#replaceAll
(stage 1 proposal)String#codePoints
(stage 1 proposal)Map.groupBy
Map.keyBy
Map#deleteAll
Map#every
Map#filter
Map#find
Map#findKey
Map#includes
Map#keyOf
Map#mapKeys
Map#mapValues
Map#merge
Map#reduce
Map#some
Map#update
Set#addAll
Set#deleteAll
Set#every
Set#filter
Set#find
Set#join
Set#map
Set#reduce
Set#some
WeakMap#deleteAll
WeakSet#addAll
WeakSet#deleteAll
compositeKey
and compositeSymbol
methods (stage 1 proposal)Number.fromString
(stage 1 proposal)Math.seededPRNG
(stage 1 proposal)Symbol.patternMatch
(for stage 1 pattern matching proposal)Symbol.dispose
(for stage 1 using
statement proposal)Promise.any
(with AggregateError
) (stage 0 proposal)URL
and URLSearchParam
from URL
standard, also stage 0 proposal to ECMAScript
URL
URL#href
URL#origin
URL#protocol
URL#username
URL#password
URL#host
URL#hostname
URL#port
URL#pathname
URL#search
URL#searchParams
URL#hash
URL#toString
URL#toJSON
URLSearchParams
URLSearchParams#append
URLSearchParams#delete
URLSearchParams#get
URLSearchParams#getAll
URLSearchParams#has
URLSearchParams#set
URLSearchParams#sort
URLSearchParams#toString
URLSearchParams#keys
URLSearchParams#values
URLSearchParams#entries
URLSearchParams#@@iterator
.forEach
method on iterable DOM collections (#329)Promise
rejection events (instead of only global handlers), #205.fetch
for correct with polyfilled Promise
and preventing problems like #178, #332, #371.@@isConcatSpreadable
to Array#concat
.@@species
to Array#{concat, filter, map, slice, splice}
..exec
calling to RegExp#{@@replace, @@split, @@match, @@search}
. Also, added fixes for RegExp#exec
method. #411, #434, #453, thanks @nicolo-ribaudo.Object#toString
does not support @@toStringTag
, add to wrapped prototypes own toString
method with @@toStringTag
logic, see #199.asap
(old stage 0 proposal) replaced by queueMicrotask
(a part of HTML spec)Observable
(#257, #276, etc.)Array#flatten
-> Array#flat
and Array#flatMap
global
stage 3 proposal - rename global
to globalThis
String#matchAll
(proposal-string-matchall#17, proposal-string-matchall#38, proposal-string-matchall#41, etc.) and move to the stage 3.name
properties of String#{trimStart, trimEnd , trimLeft, trimRight}
, move to the stage 3String#trim
(ES6 -> ES7)Array#{ flat, flatMap }
{ Array, %TypedArray% }#includes
Object.{ values, entries}
Object.getOwnPropertyDescriptors
String#{ padStart, padEnd }
String#{ trimStart, trimEnd, trimLeft, trimRight }
Promise#finally
Symbol.asyncIterator
Object#__(define|lookup)[GS]etter__
Error.isError
(withdrawn)System.global
and global
(replaced by globalThis
)Map#toJSON
and Set#toJSON
(rejected)RegExp.escape
(rejected)Reflect.enumerate
(removed from the spec)CSSRuleList
, MediaList
, StyleSheetList
Dict
Object.{classof, isObject, define, make}
Function#part
Number#@@iterator
String#{escapeHTML, unescapeHTML}
delay
.sham
flag to features which can't be properly polyfilled and / or not recommended for usage:
Symbol
constructor - we can't add new primitives. Object.prototype
accessors too expensive.Object.{create, defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyDescriptors}
, Reflect.{defineProperty, getOwnPropertyDescriptor}
can't be properly polyfilled without descriptors support.Object.{freeze, seal, preventExtensions}
, Reflect.preventExtensions
can't be properly polyfilled in ES3 environment.Object.getPrototypeOf
can be deceived in ES3 environment.Reflect.construct
can't be polyfilled for a correct work with newTarget
argument on built-ins.URL
constructor in engines without descriptors support.WeakMap
frozen keys fallback, #384.Array#reverse
bug.core-js
repository structure to monorepo with packages in /packages/
directory.core-js-pure
package (replacement for core-js/library
).core-js-bundle
package.core-js
package, leave it only in core-js-builder
package.core-js@2
to:
core-js
packagecore-js-pure
packagebower.json
core-js/library
to separate core-js-pure
package.core-js/shim
entry point, replace it just with core-js
.core-js/es
, all those features in modules
folder has es.
prefix.es7.
to esnext.
, they no longer available in core-js/es7
, use core-js/stage/*
instead of that.core-js(/library)/fn
to core-js(-pure)/features
for improve readability./es/
path (for example, core-js/es/array/from
)./stable/
entry points as an equal of /features/
for stable features, without proposals./proposals/
entry points for allow include all features from one proposal (for example, core-js/proposals/reflect-metadata
)./es|stable|features/instance/
entry points for getting polyfill of the related method for passed instance (could be used in cases like babel-runtime
).core-js/es/typed-array/from
).es.symbol
module for loading only required features, for example, in MS Edge.web.dom
namespace to web.dom-collections
.es6.regexp.{match, replace, search, split}
-> es.string.{match, replace, search, split}
- mainly it's fixes / adding support of well-known symbols to string methods, only in second place adding related methods to regexp prototype./modules/
directory by moving internal modules to /internals/
directory.core-js(/library)/fn/array/{pop, push, reverse, shift, unshift}
.core
object no longer available in the global version, entry points which previously returned it now returns globalThis
object. Also, don't set global core
property.core-js-compat
package with:
core-js
modules and API for getting a list of required core-js
modules by browserslist
query, #466.@babel/preset-env
).@babel/preset-env
).core-js-builder
package:
targets
option with browserslist
query.FAQs
core-js compat
The npm package core-js-compat receives a total of 24,699,446 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.