@putout/plugin-apply-destructuring
putout plugin adds ability use destructuring on variable declarations
Last updated 4 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-apply-destructuring 
SYNC missed versions from official npm registry.

@putout/plugin-apply-destructuring NPM version

The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.

(c) MDN

🐊Putout plugin adds ability to use destructuring on variable declarations.

Install

npm i @putout/plugin-apply-destructuring

Rule

{
    "rules": {
        "apply-destructuring/object": "on",
        "apply-destructuring/array": "on",
        "apply-destructuring/falsy": "on"
    }
}

array

❌ Example of incorrect code

const first = array[0];

✅ Example of correct code

const [first] = array;

object

❌ Example of incorrect code

const name = user.name;

✅ Example of correct code

const {name} = user;

falsy

Check out in 🐊Putout Editor.

❌ Example of incorrect code

const {maxElementsInOneLine} = {
    options,
};

✅ Example of correct code

const {maxElementsInOneLine} = options;

License

MIT

Current Tags

  • 7.1.0                                ...           latest (2 years ago)

22 Versions

  • 7.1.0                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 5.3.0                                ...           2 years ago
  • 5.2.1                                ...           4 years ago
  • 5.2.0                                ...           4 years ago
  • 5.1.1                                ...           4 years ago
  • 5.1.0                                ...           4 years ago
  • 5.0.0                                ...           5 years ago
  • 4.0.0                                ...           5 years ago
  • 3.1.0                                ...           5 years ago
  • 3.0.0                                ...           5 years ago
  • 2.4.0                                ...           5 years ago
  • 2.3.0                                ...           5 years ago
  • 2.2.1                                ...           6 years ago
  • 2.2.0                                ...           6 years ago
  • 2.1.0                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (9)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE