1.0.0 • Published 6 years ago
babel-plugin-transform-object-destructuring-to-dot-notation v1.0.0
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-notationUsage
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.
1.0.0
6 years ago
