@putout/plugin-extract-sequence-expressions
🐊Putout plugin adds ability to extract sequence expressions
Last updated 2 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-extract-sequence-expressions 
SYNC missed versions from official npm registry.

@putout/plugin-extract-sequence-expressions NPM version

The comma operator (,) evaluates each of its operands (from left to right) and returns the value of the last operand. This lets you create a compound expression in which multiple expressions are evaluated, with the compound expression's final value being the value of the rightmost of its member expressions.

(c) MDN

🐊Putout plugin adds ability to extract sequence expressions. Check out in 🐊Putout Editor.

☝️Remember, when you writing a transform you can skip all parts related to extracting sequence expressions and just reuse current plugin it will make your code simpler and less error prone.

Install

npm i @putout/plugin-extract-sequence-expressions -D

Rule

{
    "rules": {
        "extract-sequence-expressions": "on"
    }
}

❌ Example of incorrect code

module.exports.x = 1,
module.exports.y = 2;

fn((a, b));
fn(a), 'hello';

fn(a), b = 3;
fn(a), fn(b);

if (a, b, c) {}

βœ… Example of correct code

module.exports.x = 1;
module.exports.y = 2;

fn(a, b);
fn(a, 'hello');

fn(a);
b = 3;

fn(a);
fn(b);

a;
b;

if (c) {}

Comparison

Linter Rule Fix
🐊 Putout extract-sequence-expressions βœ…
⏣ ESLint no-sequences ❌

License

MIT

Current Tags

  • 3.5.0                                ...           latest (2 years ago)

24 Versions

  • 3.5.0                                ...           2 years ago
  • 3.4.0                                ...           2 years ago
  • 3.3.0                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.1                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.9.0                                ...           5 years ago
  • 1.8.0                                ...           5 years ago
  • 1.7.0                                ...           5 years ago
  • 1.6.0                                ...           5 years ago
  • 1.5.0                                ...           5 years ago
  • 1.4.0                                ...           5 years ago
  • 1.3.1                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 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 (6)
Dependents (1)

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