Socket
Socket
Sign inDemoInstall

@babel/plugin-proposal-function-bind

Package Overview
Dependencies
2
Maintainers
4
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-proposal-function-bind


Version published
Maintainers
4
Created

Package description

What is @babel/plugin-proposal-function-bind?

@babel/plugin-proposal-function-bind is a Babel plugin that allows you to use the bind operator (::) in your JavaScript code. This operator is a syntactic sugar for function binding, making it easier to bind functions to a specific context.

What are @babel/plugin-proposal-function-bind's main functionalities?

Function Binding

This feature allows you to bind a function to a specific context using the bind operator (::). In this example, the greet function is bound to the obj context, so it correctly logs 'Hello, Alice!'.

const obj = {
  name: 'Alice',
  greet() {
    console.log(`Hello, ${this.name}!`);
  }
};

const greet = obj.greet::obj;
greet(); // Output: Hello, Alice!

Partial Application

This feature allows you to create partially applied functions using the bind operator (::). In this example, the add function is partially applied with the value 5, creating a new function add5 that adds 5 to its argument.

function add(a, b) {
  return a + b;
}

const add5 = add.bind(null, 5);
console.log(add5(10)); // Output: 15

Other packages similar to @babel/plugin-proposal-function-bind

Changelog

Source

v7.22.5 (2023-06-08)

:bug: Bug Fix
  • babel-preset-env, babel-standalone
    • #15675 Fix using syntax-unicode-sets-regex in standalone (@nicolo-ribaudo)
:nail_care: Polish

Readme

Source

@babel/plugin-proposal-function-bind

Compile function bind operator to ES5

See our website @babel/plugin-proposal-function-bind for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-proposal-function-bind

or using yarn:

yarn add @babel/plugin-proposal-function-bind --dev

Keywords

FAQs

Last updated on 08 Jun 2023

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc