Socket
Book a DemoInstallSign in
Socket

@babel/plugin-transform-property-mutators

Package Overview
Dependencies
Maintainers
5
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-property-mutators

Compile ES5 property mutator shorthand syntax to Object.defineProperty

Source
npmnpm
Version
7.0.0-beta.48
Version published
Weekly downloads
19K
-36.97%
Maintainers
5
Weekly downloads
 
Created
Source

@babel/plugin-transform-property-mutators

This plugin allows Babel to transform object initializer mutators into Object.defineProperties.

Example

In

var foo = {
  get bar() {
    return this._bar;
  },
  set bar(value) {
    this._bar = value;
  }
};

Out

var foo = Object.defineProperties({}, {
  bar: {
    get: function () {
      return this._bar;
    },
    set: function (value) {
      this._bar = value;
    },
    configurable: true,
    enumerable: true
  }
});

Installation

npm install --save-dev @babel/plugin-transform-property-mutators

Usage

.babelrc

{
  "plugins": ["@babel/plugin-transform-property-mutators"]
}

Via CLI

babel --plugins @babel/plugin-transform-property-mutators script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["@babel/plugin-transform-property-mutators"]
});

Keywords

babel-plugin

FAQs

Package last updated on 24 May 2018

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