babel-plugin-transform-object-destructuring-to-dot-notation

1.0.0 • Public • Published

Build Status Commitizen friendly semantic-release codecov Dependency status

NPM

babel-plugin-transform-object-destructuring-to-dot-notation

Replaces identifiers from a destructured object by its object dot notation.

Input:

const { a, b, c } = myObject;
 
console.log(a, b, c);

Output:

console.log(myObject.a, myObject.b, myObject.c);

Install

npm i babel-plugin-transform-object-destructuring-to-dot-notation

Usage

With a configuration file (.babelrc)

{
  "plugins": [
    ["babel-plugin-transform-object-destructuring-to-dot-notation", {
      "objects": ["myObject"]
    }]
  ]
}

Via Node API

require('@babel/core').transform('code', {
  plugins: ['babel-plugin-transform-object-destructuring-to-dot-notation', {
    objects: ['myObject']
  }],
});

Options

objects

Array, defaults to undefined.

e.g. ['babel-plugin-transform-object-destructuring-to-dot-notation', { objects: ['objectOne', 'objectTwo'] }]

List of object names which destructured properties should be transformed to dot notation.

License

This project is licensed under the MIT License.

Package Sidebar

Install

npm i babel-plugin-transform-object-destructuring-to-dot-notation

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.84 kB

Total Files

5

Last publish

Collaborators

  • kuscamara