Socket
Socket
Sign inDemoInstall

@babel/helpers

Package Overview
Dependencies
32
Maintainers
6
Versions
132
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helpers

Collection of helper functions used by Babel transforms.


Version published
Maintainers
6
Weekly downloads
38,844,487
decreased by-5.96%

Weekly downloads

Package description

What is @babel/helpers?

The @babel/helpers package is part of the Babel toolchain, which is primarily used for converting ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments. This specific package contains a set of functions that are used by Babel's transform plugins to avoid code duplication across generated output. These helpers are small snippets of code that perform common tasks used by the transformations, such as handling classes, spreading properties, etc.

What are @babel/helpers's main functionalities?

Class handling

This code demonstrates a helper function used by Babel to ensure that a class is only instantiated with the `new` keyword, preventing incorrect usage.

"use strict";\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar MyClass = function MyClass() { _classCallCheck(this, MyClass); };

Spread properties

This helper function is used to emulate the behavior of the object spread operator `{...obj}`, allowing properties from one or more source objects to be copied into a new object.

"use strict";\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nvar obj = _extends({}, sourceObj, { key: 'value' });

Other packages similar to @babel/helpers

Changelog

Source

v7.17.0 (2022-02-02)

:rocket: New Feature
  • babel-cli, babel-core
    • #14065 Allow plugins/presets to indicate external dependencies (@nicolo-ribaudo)
  • babel-core, babel-parser, babel-traverse
    • #14174 Expose .index on Position to internally track nodes location (@tolmasky)
  • babel-generator, babel-parser, babel-plugin-proposal-pipeline-operator, babel-plugin-syntax-pipeline-operator
  • babel-traverse
    • #13940 Add new method to check if node is null or not (@danez)
  • babel-generator, babel-parser, babel-plugin-syntax-destructuring-private, babel-standalone
  • babel-helper-create-class-features-plugin, babel-helpers, babel-plugin-proposal-decorators, babel-plugin-syntax-decorators, babel-runtime-corejs2, babel-runtime-corejs3, babel-runtime, babel-standalone, babel-types
  • babel-generator, babel-parser, babel-traverse, babel-types
  • babel-core, babel-helper-create-regexp-features-plugin, babel-plugin-proposal-unicode-sets-regex, babel-plugin-syntax-unicode-sets-regex, babel-plugin-transform-dotall-regex
  • babel-parser
  • babel-register
:bug: Bug Fix
  • babel-parser
  • babel-plugin-transform-runtime
:memo: Documentation
:house: Internal
  • babel-helper-fixtures, babel-parser
  • babel-compat-data
    • #14208 Update compat data (specifically for rhino 1.7.14) (@phulin)
  • Other
:running_woman: Performance
  • babel-cli, babel-core

Readme

Source

@babel/helpers

Collection of helper functions used by Babel transforms.

See our website @babel/helpers for more information.

Install

Using npm:

npm install --save-dev @babel/helpers

or using yarn:

yarn add @babel/helpers --dev

FAQs

Last updated on 02 Feb 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • 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