Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
@babel/plugin-transform-spread
Advanced tools
Package description
The @babel/plugin-transform-spread npm package is a plugin for Babel, a JavaScript compiler, that transforms spread properties in object literals and spread elements in array literals into a form that can be understood by environments that do not support the spread syntax. This transformation ensures compatibility with older browsers or JavaScript environments.
Object Spread
Transforms spread properties in object literals to use Object.assign, enabling the combination of multiple objects into one.
{"const obj1 = { a: 1, b: 2 };\nconst obj2 = { ...obj1, c: 3 };\n// Transformed to:\n// const obj2 = Object.assign({}, obj1, { c: 3 });"}
Array Spread
Transforms spread elements in array literals to use Array.concat, allowing the creation of new arrays by combining or adding elements.
{"const arr1 = [1, 2];\nconst arr2 = [...arr1, 3, 4];\n// Transformed to:\n// const arr2 = arr1.concat([3, 4]);"}
This package provides functionality similar to @babel/plugin-transform-spread but focuses on both spreading of elements and the rest properties for object destructuring assignment and spread properties for object literals. It's a more comprehensive solution for handling spread and rest properties in modern JavaScript.
While not a direct alternative, core-js includes polyfills for many ECMAScript features, including the spread syntax. It allows developers to use spread syntax in environments that do not natively support it by providing the necessary polyfills.
Changelog
v7.19.0 (2022-09-05)
babel-parser
babel-helpers
, babel-plugin-proposal-async-generator-functions
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
babel-generator
, babel-helpers
, babel-parser
, babel-plugin-proposal-decorators
, babel-plugin-syntax-decorators
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
babel-parser
decoratorsBeforeExport
default to false
(@nicolo-ribaudo)babel-generator
, babel-parser
babel-standalone
babel-helper-create-regexp-features-plugin
, babel-helpers
, babel-plugin-proposal-duplicate-named-capturing-groups-regex
, babel-plugin-transform-named-capturing-groups-regex
, babel-standalone
babel-helper-function-name
, babel-helper-wrap-function
, babel-plugin-transform-classes
babel-plugin-transform-typescript
#privateField!
(@liuxingbaoyu)babel-parser
babel-helper-builder-react-jsx
babel-core
@babel/core
functions in config errors (@nicolo-ribaudo)Readme
Compile ES2015 spread to ES5
See our website @babel/plugin-transform-spread for more information.
Using npm:
npm install --save-dev @babel/plugin-transform-spread
or using yarn:
yarn add @babel/plugin-transform-spread --dev
FAQs
Compile ES2015 spread to ES5
The npm package @babel/plugin-transform-spread receives a total of 19,245,880 weekly downloads. As such, @babel/plugin-transform-spread popularity was classified as popular.
We found that @babel/plugin-transform-spread demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.