babel/packages/babel-plugin-transform-object-set-prototype-of-to-assign
Henry Zhu e86f62b304 README: add --save-dev [skip ci]
Closes gh-4910
2016-11-29 08:40:27 -05:00
..
2015-09-15 06:12:46 +01:00
2015-09-15 06:12:46 +01:00
2016-05-02 19:43:49 -04:00
2016-11-29 08:40:27 -05:00

babel-plugin-transform-object-set-prototype-of-to-assign

The object-set-prototype-of-to-assign plugin will transform all Object.setPrototypeOf calls to a method that will do a shallow defaults of all properties.

NOTE: There are some caveats when using this plugin, see the babel-plugin-transform-proto-to-assign README for more information..

Example

In

Object.setPrototypeOf(bar, foo);

Out

var _defaults = ...;

_defaults(bar, foo);

Installation

npm install --save-dev babel-plugin-transform-object-set-prototype-of-to-assign

Usage

.babelrc

{
  "plugins": ["transform-object-set-prototype-of-to-assign"]
}

Via CLI

babel --plugins transform-object-set-prototype-of-to-assign script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-object-set-prototype-of-to-assign"]
});