@putout/plugin-extract-object-properties

9.0.0 • Public • Published

@putout/plugin-extract-object-properties NPM version

The destructuring assignment makes possible to unpack values from objects into distinct variables.

(c) MDN

🐊Putout plugin adds ability to apply destructuring to extract object properties.

Install

npm i @putout/plugin-extract-object-properties -D

Rule

{
    "rules": {
        "extract-object-properties/equal-deep": "on",
        "extract-object-properties/not-equal-deep": "on"
    }
}

Equal Deep

Example of incorrect code

const {replaceWith} = a.operate;
const {isIdentifier} = a.types;

Example of correct code

const {
    operator,
    types,
} = a;

const {replaceWith} = operator;
const {isIdentifier} = types;

Not Equal Deep

Example of incorrect code

const {replaceWith} = a;
const {isIdentifier} = a.types;

Example of correct code

const {replaceWith, types} = a;
const {isIdentifier} = types;

License

MIT

Package Sidebar

Install

npm i @putout/plugin-extract-object-properties

Weekly Downloads

14,698

Version

9.0.0

License

MIT

Unpacked Size

8.06 kB

Total Files

6

Last publish

Collaborators

  • coderaiser