1.0.0 • Published 4 years ago

babel-plugin-transform-object-destructuring-to-dot-notation v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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.