@putout/plugin-extract-sequence-expressions
🐊Putout plugin adds ability to extract sequence expressions
Last updated 7 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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

  • 4.1.0                                ...           latest (7 months ago)

26 Versions

  • 4.1.0                                ...           7 months ago
  • 4.0.0                                ...           10 months ago
  • 3.5.0                                ...           3 years ago
  • 3.4.0                                ...           3 years ago
  • 3.3.0                                ...           3 years ago
  • 3.2.0                                ...           3 years ago
  • 3.1.1                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.2.0                                ...           5 years ago
  • 2.1.1                                ...           5 years ago
  • 2.1.0                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.9.0                                ...           7 years ago
  • 1.8.0                                ...           7 years ago
  • 1.7.0                                ...           7 years ago
  • 1.6.0                                ...           7 years ago
  • 1.5.0                                ...           7 years ago
  • 1.4.0                                ...           7 years ago
  • 1.3.1                                ...           7 years ago
  • 1.3.0                                ...           7 years ago
  • 1.2.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 14
Last Day 0
Last Week 14
Last Month 1
Dependencies (0)
None
Dev Dependencies (7)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |