Big news!Introducing Socket AI - ChatGPT-Powered Threat Analysis.Learn more
Socket
Socket

core-js

Package Overview
Dependencies
0
Maintainers
1
Versions
256
Issues
File Explorer

Advanced tools

core-js

Standard library

    3.30.2latest
    GitHub
    npm

Version published
Maintainers
1
Weekly downloads
39,252,720
increased by8.36%

Weekly downloads

Changelog

Source

3.30.2 - 2023.05.07

  • Added a fix for a NodeJS 20.0.0 bug with cloning File via structuredClone
  • Added protection from Terser unsafe String optimization, #1242
  • Added a workaround for getting proper global object in Figma plugins, #1231
  • Compat data improvements:

Readme

Source

logo

fundraising PRs welcome version core-js downloads

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

Modular standard library for JavaScript. Includes polyfills for ECMAScript up to 2023: 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.

Raising funds

core-js isn't backed by a company, so the future of this project depends on you. Become a sponsor or a backer if you are interested in core-js: Open Collective, Patreon, Boosty, Bitcoin ( bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz ), Alipay.




Example of usage:

import 'core-js/actual'; Promise.resolve(42).then(it => console.log(it)); // => 42 Array.from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5] [1, 2].flatMap(it => [it, it]); // => [1, 1, 2, 2] (function * (i) { while (true) yield i++; })(1) .drop(1).take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])

You can load only required features:

import 'core-js/actual/promise'; import 'core-js/actual/set'; import 'core-js/actual/iterator'; import 'core-js/actual/array/from'; import 'core-js/actual/array/flat-map'; import 'core-js/actual/structured-clone'; Promise.resolve(42).then(it => console.log(it)); // => 42 Array.from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5] [1, 2].flatMap(it => [it, it]); // => [1, 1, 2, 2] (function * (i) { while (true) yield i++; })(1) .drop(1).take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])

Or use it without global namespace pollution:

import Promise from 'core-js-pure/actual/promise'; import Set from 'core-js-pure/actual/set'; import Iterator from 'core-js-pure/actual/iterator'; import from from 'core-js-pure/actual/array/from'; import flatMap from 'core-js-pure/actual/array/flat-map'; import structuredClone from 'core-js-pure/actual/structured-clone'; Promise.resolve(42).then(it => console.log(it)); // => 42 from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5] flatMap([1, 2], it => [it, it]); // => [1, 1, 2, 2] Iterator.from(function * (i) { while (true) yield i++; }(1)) .drop(1).take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])

It's a global version (first 2 examples), for more info see core-js documentation.

Keywords

FAQs

Last updated on 06 May 2023

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
Socket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc