@putout/plugin-apply-nullish-coalescing

putout plugin add ability to apply nullish coalescing operator (??)

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@putout/plugin-apply-nullish-coalescing
46001.0.03 years ago3 years agoMinified + gzip package size for @putout/plugin-apply-nullish-coalescing in KB

Readme

putout plugin apply optional chaining.

Install

npm i @putout/plugin-apply-nullish-coalescing

Rule

{
    "rules": {
        "apply-nullish-coalescing": true
    }
}

❌ Incorrect code example

result = result || 'hello';
result = typeof result  === 'undefined' ? 'hello': result;

✅ Correct code Example

const result = result ?? 'hello';

License

MIT