Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-transform-es2015-spread

Package Overview
Dependencies
Maintainers
6
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-es2015-spread

Compile ES2015 spread to ES5

  • 7.0.0-alpha.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
648K
decreased by-62.37%
Maintainers
6
Weekly downloads
 
Created

What is babel-plugin-transform-es2015-spread?

The babel-plugin-transform-es2015-spread npm package is used to compile ES2015 spread syntax to a version of JavaScript that can run in environments that do not support this syntax natively. Spread syntax allows an iterable such as an array to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.

What are babel-plugin-transform-es2015-spread's main functionalities?

Function Calls

This feature allows an array of arguments to be spread out and passed as individual arguments to a function call. The code sample demonstrates spreading an array into a function call.

function sum(x, y, z) { return x + y + z; } const numbers = [1, 2, 3]; console.log(sum(...numbers));

Array Literals

Spread syntax can be used to concatenate arrays or insert multiple elements into an array at once. The code sample shows how to use spread syntax to merge arrays.

const parts = ['shoulders', 'knees']; const body = ['head', ...parts, 'toes'];

Object Literals

This feature allows for the properties of one or more source objects to be copied into a new object. The code sample demonstrates both cloning and merging objects using spread syntax.

const obj1 = { foo: 'bar', x: 42 }; const obj2 = { foo: 'baz', y: 13 }; const clonedObj = { ...obj1 }; const mergedObj = { ...obj1, ...obj2 };

Other packages similar to babel-plugin-transform-es2015-spread

Keywords

FAQs

Package last updated on 17 Apr 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc