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

babel-plugin-transform-es2015-arrow-functions

Package Overview
Dependencies
Maintainers
6
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-es2015-arrow-functions

Compile ES2015 arrow functions to ES5

  • 6.22.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
decreased by-14.59%
Maintainers
6
Weekly downloads
 
Created

What is babel-plugin-transform-es2015-arrow-functions?

The babel-plugin-transform-es2015-arrow-functions package is a Babel plugin that transforms ES2015 (ES6) arrow functions into ES5 function expressions. This is useful for ensuring compatibility with environments that do not support ES2015 syntax.

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

Transform Arrow Functions

This feature transforms ES2015 arrow functions into ES5 function expressions. This is particularly useful for ensuring that your code runs in environments that do not support ES2015 syntax.

const add = (a, b) => a + b;
// Transformed to:
var add = function(a, b) {
  return a + b;
};

Lexical 'this' Binding

Arrow functions do not have their own 'this' context and instead inherit 'this' from the parent scope. This feature ensures that the 'this' context is correctly bound when transforming arrow functions to ES5.

const obj = {
  value: 10,
  increment: function() {
    setTimeout(() => {
      this.value++;
    }, 1000);
  }
};
// Transformed to:
var obj = {
  value: 10,
  increment: function() {
    var _this = this;
    setTimeout(function() {
      _this.value++;
    }, 1000);
  }
};

Other packages similar to babel-plugin-transform-es2015-arrow-functions

Keywords

FAQs

Package last updated on 20 Jan 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