7.1.0 β€’ Published 11 months ago

@putout/plugin-apply-destructuring v7.1.0

Weekly downloads
2,811
License
MIT
Repository
github
Last release
11 months ago

@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

7.0.0

12 months ago

7.1.0

11 months ago

6.1.0

1 year ago

6.0.0

1 year ago

5.3.0

2 years ago

5.2.1

3 years ago

5.2.0

3 years ago

5.1.1

3 years ago

5.1.0

3 years ago

5.0.0

4 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

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago