@putout/plugin-apply-destructuring
🐊Putout plugin adds ability use destructuring on variable declarations
Last updated a year ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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. Renamed to @putout/plugin-destructuring.

Install

npm i @putout/plugin-apply-destructuring

Rules

Config

Short:

{
    "rules": {
        "apply-destructuring": "on"
    }
}

Full:

{
    "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;

hello = world.hello;

βœ… Example of correct code

const {name} = user;

({hello} = world);

falsy

Check out in ????Putout Editor.

❌ Example of incorrect code

const {maxElementsInOneLine} = {
    options,
};

βœ… Example of correct code

const {maxElementsInOneLine} = options;

convert-object-to-array

Check out in ????Putout Editor.

❌ Example of incorrect code

const {0: a, 1: b} = c;

βœ… Example of correct code

const [a, b] = c;

License

MIT

Current Tags

  • 10.1.1                                ...           latest (4 months ago)

28 Versions

  • 10.1.1                                ...           4 months ago
  • 10.1.0                                ...           5 months ago
  • 10.0.0                                ...           7 months ago
  • 9.0.0                                ...           a year ago
  • 8.0.1                                ...           a year ago
  • 8.0.0                                ...           a year ago
  • 7.1.0                                ...           3 years ago
  • 7.0.0                                ...           3 years ago
  • 6.1.0                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.3.0                                ...           4 years ago
  • 5.2.1                                ...           5 years ago
  • 5.2.0                                ...           5 years ago
  • 5.1.1                                ...           5 years ago
  • 5.1.0                                ...           5 years ago
  • 5.0.0                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.1.0                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.4.0                                ...           7 years ago
  • 2.3.0                                ...           7 years ago
  • 2.2.1                                ...           7 years ago
  • 2.2.0                                ...           7 years ago
  • 2.1.0                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (0)
None
Dev Dependencies (8)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |