Socket
Socket
Sign inDemoInstall

@putout/plugin-extract-sequence-expressions

Package Overview
Dependencies
387
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @putout/plugin-extract-sequence-expressions

🐊Putout plugin adds ability to extract sequence expressions


Version published
Weekly downloads
16K
decreased by-13.41%
Maintainers
1
Install size
7.31 kB
Created
Weekly downloads
 

Readme

Source

@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

LinterRuleFix
🐊 Putoutextract-sequence-expressions
ESLintno-sequences

License

MIT

Keywords

FAQs

Last updated on 28 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc