open-index/open-npm huggingface dataset:
npm package: @putout/operator-json
Description: 🐊Putout operator adds ability to work with json
Author: coderaiser
Latest version: 3.3.1

# @putout/operator-json [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-json.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-json "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to lint json.

## Install

```
npm i putout @putout/operator-json
```

## API

### `__json`

```js
import {operator} from 'putout';

const {__json} = operator;

export const traverse = ({push}) => ({
    [__json]: push,
});
```

### `__yaml`

```js
import {operator} from 'putout';

const {__yaml} = operator;

export const traverse = ({push}) => ({
    [__yaml]: push,
});
```

### `__toml`

```js
import {operator} from 'putout';

const {__toml} = operator;

export const traverse = ({push}) => ({
    [__toml]: push,
});
```

### `__docker`

```js
import {operator} from 'putout';

const {__docker} = operator;

export const traverse = ({push}) => ({
    [__docker]: push,
});
```

### `__ignore`

```js
import {operator} from 'putout';

const {__ignore} = operator;

export const traverse = ({push}) => ({
    [__ignore]: push,
});
```

### `__filesystem`

```js
import {operator} from 'putout';

const {__filesystem} = operator;

export const traverse = ({push}) => ({
    [__filesystem]: (path) => {
        push(path);
    },
});
```

### `isJSON(source: string)`

```js
isJSON(`__putout_processor_json({"hello": "world"});`);
// returns
true;

isJSON(`hello({"hello": "world"});`);
// returns
false;
```

### `isTOML(source: string)`

```js
isTOML(`__putout_processor_toml({"hello": "world"});`);
// returns
true;
```

### `isDocker(source: string)`

```js
isDocker(`__putout_processor_docker(['MAINTAINER', 'abc']);`);
// returns
true;
```

### `isJSONJGroup(source: string)`

```js
isJSONGroup(`__putout_processor_toml({"hello": "world"});`);
// returns
true;
```

### `toJS(source: string, name?: string)`;

```js
import {operator} from 'putout';

const {__filesystem, toJS} = operator;
toJS('{"hello": "world"}');
// returns
`__putout_processor_json('{"hello": "world"});`;

toJS('{"hello": "world"}', __filesystem);
// returns
`__putout_processor_filesystem('{"hello": "world"});`;
```

### `fromJS(source: string, name?: string)`;

```js
import {operator} from 'putout';

const {fromJS} = operator;
fromJS(`__putout_processor_json('{"hello": "world"}'`);
// returns
`{"hello": "world"}`;
```

## License

MIT
npm package: @putout/operator-keyword
Description: 🐊Putout operator adds ability to check if whether Identifier is a keyword or not
Author: coderaiser
Latest version: 5.1.1

# @putout/operator-keyword [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-keyword.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-keyword "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to check whether `Identifier` is a `keyword` or not.

## Install

```
npm i putout @putout/operator-keyword
```

## API

```js
import {operator} from 'putout';

const {
    isKeyword,
    isTSKeyword,
    isDeclarationKeyword,
    isModuleDeclarationKeyword,
    isConditionKeyword,
} = operator;

isKeyword('if');
// returns
true;

isKeyword('abc');
// returns
false;

isDeclarationKeyword('const');
// returns
true;

isModuleDeclarationKeyword('import');
// returns
true;

isConditionKeyword('if');
// returns
true;

isStatementKeyword('for');
// returns
true;

isTSKeyword('implements');
// returns
true;
```

### `isLegacyKeyword`

> A previous version of `import attributes` used the `assert` keyword instead of with. The assertion feature is now non-standard.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with)

```js
import {operator} from 'putout';

const {isLegacyKeyword} = operator;

isLegacyKeyword('assert');
// returns
true;
```

## License

MIT
npm package: @putout/operator-parens
Description: 🐊Putout operator adds ability to work with parens
Author: coderaiser
Latest version: 4.0.0

# @putout/operator-parens [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-parens.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-parens "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to lint parens.

## Install

```
npm i putout @putout/operator-parens
```

## API

### `addParens(path: Path): Path`

Add parens around expression depending on used `printer`:

- ✅ set `node.extra.parenthesized: true` when `@putout/printer` used;
- ✅ set add `ParenthesizedExpression` or `TSParenthesizedType` when `babel` used;

```js
import {operator} from 'putout';

const {addParens} = operator;

addParens(path);
```

### `removeParens(path: Path): Path`

Remove parens around expression depending on used `printer`:

- ✅ set `node.extra.parenthesized: false` when `@putout/printer` used;
- ✅ remove `ParenthesizedExpression` or `TSParenthesizedType` when `babel` used;

```js
import {operator} from 'putout';

const {removeParens} = operator;

removeParens(path);
```

### `hasParens(path: Path): Boolean`

Check if `path` has parens around expression depending on used `printer`:

- ✅ checks `node.extra.parenthesized` when `@putout/printer` used;
- ✅ check if parent node type is `ParenthesizedExpression` or `TSParenthesizedType` when `babel` used;

```js
import {operator} from 'putout';

const {hasParens} = operator;

hasParens(path);
```

## License

MIT
npm package: @putout/operator-regexp
Description: 🐊Putout operator adds ability to check if provided regexp can be converted to string without losing it's sense
Author: coderaiser
Latest version: 5.0.0

# @putout/operator-regexp [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-regexp.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-regexp "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to determine that provided [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) can be
converted to [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) without losing it's sense.

It is used for example in [regexp/convert-replace-to-relace-all](https://github.com/coderaiser/putout/tree/master/packages/plugin-regexp#regexpconvert-replace-to-replace-all):

```diff
-'hello'.replace(/hello/g, 'world');
+'hello'.replaceAll('hello', 'world');
```

## Install

```
npm i putout @putout/operator-regexp
```

## API

### isSimpleRegexp(regexp: RegExp)

```js
const {operator} = require('putout');
const {isSimpleRegExp} = operator;

isSimpleRegExp(/hello world/);
// returns
true;

isSimpleRegExp(/^hello/);
// returns
false;
```

### transformRegExp(regexp: String, plugin: Traverser)

```js
transformRegExp('[aab]', {
    report,
    fix,
    traverse,
});
```

## License

MIT
npm package: @putout/operator-remove-files
Description: 🐊Putout operator adds ability to remove files to plugins
Author: coderaiser
Latest version: 1.1.0

# @putout/operator-remove-files [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-remove-files.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-remove-files "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to create plugins that removes files.

## Install

```
npm i putout @putout/operator-remove-files
```

## API

```js
import {operator} from 'putout';

const {removeFiles} = operator;

export const {
    report,
    fix,
    scan,
} = removeFiles(['.DS_Store']);
```

### `dismiss`

Any rule that uses this operator can pass `dismiss` to avoid removing files:

```json
{
    "rules": {
        "putout/remove-files": ["on", {
            "dismiss": [".DS_Store"]
        }]
    }
}
```

## License

MIT
npm package: @putout/operator-rename-files
Description: 🐊Putout operator adds ability to rename files to plugins
Author: coderaiser
Latest version: 6.2.1

# @putout/operator-rename-files [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-rename-files.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-rename-files "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to rename files to plugins.

## Install

```
npm i putout @putout/operator-rename-files
```

## API

If you want to create 🐊[**Putout**](https://github.com/coderaiser/putout) `plugin` that will rename files according to your needs just use for **ESM**:

```js
import {operator} from 'putout';

const {renameFiles} = operator;

export const {
    report,
    fix,
    scan,
} = renameFiles({
    type: 'module',
    mask: '*.mjs',
    rename(name) {
        return name.replace(/mjs$/, 'js');
    },
});
```

And for **CommonJS**:

```js
module.exports = renameFiles({
    type: 'commonjs',
    mask: '*.cjs',
    rename(name) {
        return name.replace(/cjs$/, 'js');
    },
});
```

When you do not need to check `type` field of `package.json`, avoid `type` field:

```js
module.exports = renameFiles({
    mask: '*.cjs',
    rename(name) {
        return name.replace(/cjs$/, 'js');
    },
});
```

### renameFiles({mask, from, to})

You can pass `from` and `to` instead of `rename` for declarative renaming.

```js
export const {
    report,
    fix,
    scan,
} = renameFiles({
    mask: '*.spec.*',
    from: 'spec',
    to: 'test',
});
```

### renameFiles({from, to, near})

Rename files located near `package.json`:

```js
export const {
    report,
    fix,
    scan,
} = renameFiles({
    from: 'madrun.js',
    to: '.madrun.js',
    near: 'package.json',
});
```

You can also use [`redlint`](https://github.com/putoutjs/redlint) directly.

## License

MIT
npm package: @putout/operator-rename-properties
Description: 🐊Putout operator adds ability to create rules that renames properties
Author: coderaiser
Latest version: 1.0.1

# @putout/operator-rename-properties [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-rename-properties.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-rename-properties "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator add ability to create rules that renames properties.

## Install

```
npm i putout @putout/operator-rename-properties
```

## API

### rename

When you want to rename properties:

```diff
{
    "rules": {
-       "merge-duplicate-imports": "off"
+       "esm/merge-duplicate-imports": "off"
    },
}
```

Use:

```js
import {operator} from 'putout';

const {renameProperties} = operator;

export const {
    report,
    fix,
    traverse,
} = renameProperties([
    ['merge-duplicate-imports', 'esm/merge-duplicate-imports'],
]);
```

### remove

When you whant to remove properties:

```diff
{
    "rules": {
-       "merge-duplicate-imports": "off"
    },
}
```

Use:

```js
import {operator} from 'putout';

const {renameProperties} = operator;

export const {
    report,
    fix,
    traverse,
} = renameProperties([
    ['merge-duplicate-imports', ''],
]);
```

## License

MIT
npm package: @putout/operator-sort-ignore
Description: 🐊Putout operator adds ability to sort ignore
Author: coderaiser
Latest version: 2.3.0

# @putout/operator-sort-ignore [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-sort-ignore.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-sort-ignore "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator simplify ability to create plugins that sorts `ignore`.

## Install

```
npm i putout @putout/operator-sort-ignore
```

## Rule

### ❌ Example of incorrect code

```ignore
node_modules
*.swp
yarn-error.log
yarn.lock
.idea
.DS_Store
deno.lock

coverage
.filesystem.json
```

### ✅ Example of correct code

```ignore
.idea
.filesystem.json
.DS_Store

*.swp

yarn-error.log
yarn.lock
deno.lock

node_modules
coverage
```

## API

### `sortIgnore`

```js
import {operator} from 'putout';

const {sortIgnore} = operator;

export const {
    report,
    fix,
    traverse,
} = sortIgnore({
    name: '.gitignore',
});
```

### `type`

```js
import {operator} from 'putout';

const {__json, sortIgnore} = operator;

export const {
    report,
    fix,
    traverse,
} = sortIgnore({
    type: __json,
    name: '.nycrc.json',
    field: 'exclude',
});
```

## License

MIT
npm package: @putout/operator-type-checker
Description: 🐊Putout operator adds ability to create type checker
Author: coderaiser
Latest version: 1.1.1

# @putout/operator-type-checker [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-type-checker.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-type-checker "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to create `type-checker`.

## Install

```
npm i putout @putout/operator-type-checker
```

## API

When you need to filter out all `CallExpression` nodes without `MemberExpression` inside, like: `fn('hello')`, but not `fn(a.b)`, use:

```js
const {operator} = require('putout');
const {createTypeChecker} = operator;

const check = createTypeChecker([
    '-: -> !MemberExpression',
    '+: parentPath -> CallExpression',
]);
```

## Coverage

The strong side of Type Checker is coverage reports:

> 🌴 Checkers Covered

To check coverage set `PUTOUT_INSTRUMENT=1` when running tests.

When you need to setup tests coverage check on ending of tests just use:

```js
import {callWhenTestsEnds} from 'supertape';
import {whenTestsEnds} from '@putout/printer/type-checker/when-tests-ends';

callWhenTestsEnds('PUTOUT_INSTRUMENT', whenTestsEnds);
``````

It is already handled in `@putout/test`, so if you use it - you covered 😏.

## License

MIT
npm package: @putout/operator-watermark
Description: 🐊Putout operator adds ability to work with watermark
Author: coderaiser
Latest version: 1.0.1

# @putout/operator-watermark [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-watermark.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-watermark "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to use watermark.

## Install

```
npm i putout @putout/operator-watermark
```

## API

```js
import {watermark} from '@putout/operator-watermark';

watermark.init();

if (!watermark.has())
    watermark.add();

clearWatermark(node);
```

## License

MIT
npm package: @putout/plugin-add-missing-new
Description: 🐊Putout plugin adds ability to add missing operator 'new'
Author: coderaiser
Latest version: 1.0.2

# @putout/plugin-add-missing-new [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-add-missing-new.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-add-missing-new "npm"

> The `Set` constructor lets you create Set objects that store unique values of any type, whether primitive values or object references.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/Set)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to add missing operator `new`, since built-in objects:

- `Set`;
- `WeakSet`;
- `Map`;
- `WeakMap`;
- `Int8Array`;
- `Uint8Array`;
- `Uint8ClampedArray`;
- `Int16Array`;
- `Uint16Array`;
- `Int32Array`;
- `Uint32Array`;
- `Float32Array`;
- `Float64Array`;
- `BigInt64Array`;
- `BigUint64Array`;

Produces [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) when called without `new` like this:

```
Uncaught TypeError: Constructor Set requires 'new'
```

Part of [`@putout/plugin-new`](https://www.npmjs.com/package/@putout/plugin-new).

## Install

```
npm i @putout/plugin-add-missing-new
```

## Rule

```json
{
    "rules": {
        "add-missing-new": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const map = Map();
```

## ✅ Example of correct code

```js
const map = new Map();
```

## License

MIT
npm package: @putout/plugin-add-missing-parens
Description: 🐊Putout plugin adds missing parens
Author: coderaiser
Latest version: 2.0.1

# @putout/plugin-add-missing-parens [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-add-missing-parens.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-add-missing-parens"npm"

> The JavaScript exception "tagged template cannot be used with optional chain" occurs when the tag expression of a tagged template literal is an optional chain, or if there's an optional chain between the tag and the template.
>
> (c) [**MDN**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Bad_optional_template)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to add missing parens. Check out in 🐊[**Putout Editor**](https://putout.vercel.app/#/gist/a8ab0ffefed3b1e7dd0f43d794ea86f4/5d45fcc2e283b5b2d0b9e155010d1114b9f0a7ee). Merged to [`@putout/plugin-parens`](https://www.npmjs.com/package/@putout/plugin-parens).

## Install

```
npm i @putout/plugin-add-missing-parens
```

## Rule

```json
{
    "rules": {
        "add-missing-parens": "on"
    }
}
```

## ❌ Example of incorrect code

```ts
getConsoleLog?.()``;
String?.raw``;
String?.raw!``;

await asyncFn()?.filter((x) => x);
```

## ✅ Example of correct code

```ts
(getConsoleLog?.())``;
(String?.raw)``;
String?.raw!``;

(await asyncFn())?.filter((x) => x);
```

## License

MIT
npm package: @putout/plugin-add-return-await
Description: putout plugin adds ability to find and remove test.only calls
Author: coderaiser
Latest version: 2.1.1

# @putout/plugin-add-return-await [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-add-return-await.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-add-return-await"npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and add `return await`. Part of [@putout/promises](https://github.com/coderaiser/putout/blob/master/packages/plugin-promises/README.md).

## Install

```
npm i @putout/plugin-add-return-await
```

## Rule

```json
{
    "rules": {
        "add-return-await": "on"
    }
}
```

## ❌ Example of incorrect code

```js
async function world() {
    return hello();
}
```

## ✅ Example of correct code

```js
async function world() {
    return await hello();
}
```

## License

MIT
npm package: @putout/plugin-apply-array-at
Description: 🐊Putout plugin adds ability apply array.at
Author: coderaiser
Latest version: 2.1.2

# @putout/plugin-apply-array-at [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-array-at.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-array-at "npm"

> The `at()` method takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array.
>
> This is not to suggest there is anything wrong with using the square bracket notation.
> For example `array[0]` would return the first item. However instead of using `array.length` for latter items; e.g. `array[array.length - 1]` for the last item, you can call `array.at(-1)`.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply [`array.at()`](https://github.com/tc39/proposal-relative-indexing-method). Renamed to [`@putout/plugin-apply-at`](https://www.npmjs.com/package/@putout/plugin-apply-at).

## Install

```
npm i @putout/plugin-apply-array-at
```

## Rule

```json
{
    "rules": {
        "apply-array-at": "on"
    }
}
```

## ❌ Example of incorrect code

```ts
const latest = (a) => a[a.length - 1];
```

## ✅ Example of correct code

```ts
const latest = (a) => a.at(-1);
```

## License

MIT
npm package: @putout/plugin-apply-arrow
Description: 🐊Putout plugin adds ability to convert Function Declaration to Arrow Function
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-apply-arrow [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-arrow.svg?style=flarrow&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-arrow "npm"

> An arrow function expression is a compact alternative to a traditional function expression, with some semantic differences and deliberate limitations in usage:
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to convert Function Declaration to Arrow Function. Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/828228d2515805afc682eab0fe0a4105/a2c6507dd197d04cbbd387e4fb414ef6548234cf).

## Install

```
npm i @putout/plugin-apply-arrow
```

## Rule

```json
{
    "rules": {
        "apply-arrow": ["on", {
            "maxSize": 30
        }]
    }
}
```

## ❌ Example of incorrect code

```js
export function replace() {
    return {
        'if __a > __b': 'if (__a > __b)',
    };
}
```

## ✅ Example of correct code

```js
export const replace = () => ({
    'if __a > __b': 'if (__a > __b)',
});
```

## License

MIT
npm package: @putout/plugin-apply-as-type-assertions
Description: putout plugin adds ability to apply as type assertion
Author: coderaiser
Latest version: 1.1.3

# @putout/plugin-apply-as-type-assertions [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-as-type-assertions.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-as-type-assertions "npm"

🐊[`Putout`](https://github.com/coderaiser/putout) plugin adds ability to apply `as` type assertion according to [best practices](https://basarat.gitbook.io/typescript/type-system/type-assertion#as-foo-vs.-less-than-foo-greater-than).
Moved to [`@putout/plugin-typescript`](https://github.com/coderaiser/putout/v24.0.2/master/packages/plugin-typescript#apply-as-type-assertion).

## Install

```
npm i @putout/plugin-apply-as-type-assertions
```

## Rule

Rule `apply-as-type-assertions` is not bundled by default, to `enable` add to `.putout.json`:

## Rule

```json
{
    "rules": {
        "apply-as-type-assertions": "on"
    }
}
```

## ❌ Incorrect code example

```ts
const boundaryElement = <HTMLElement>e.target;
```

## ✅ Correct code Example

```ts
const boundaryElement1 = e.target as HTMLElement;
```

## License

MIT
npm package: @putout/plugin-apply-at
Description: 🐊Putout plugin adds ability apply at()
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-apply-at [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-at.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-at "npm"

> The `at()` method takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array.
>
> (c) [Array.prototype.at()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at)

> The `at()` method takes an integer value and returns a new `String` consisting of the single UTF-16 code unit located at the specified offset. This method allows for positive and negative integers. Negative integers count back from the last string character.>
>
> (c) [String.prototype.at()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/at)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply [`array.at()`](https://github.com/tc39/proposal-relative-indexing-method).

## Install

```
npm i @putout/plugin-apply-at
```

## Rule

```json
{
    "rules": {
        "apply-at": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const latest = (a) => a[a.length - 1];
```

## ✅ Example of correct code

```js
const latest = (a) => a.at(-1);
```

## License

MIT
npm package: @putout/plugin-apply-await-import
Description: putout plugin adds ability apply await import
Author: coderaiser
Latest version: 1.1.1

# @putout/plugin-apply-await-import [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-await-import.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-await-import"npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to add forgotten **await** to [**dynamic `import()`**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#dynamic_imports). Part of [`@putout/plugin-promises`](https://www.npmjs.com/package/@putout/plugin-promises).

## Install

```
npm i @putout/plugin-apply-await-import
```

## Rule

```json
{
    "rules": {
        "apply-await-import": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const {readFile} = import('fs/promises');
```

## ✅ Example of correct code

```js
const {readFile} = await import('fs/promises');
```

## License

MIT
npm package: @putout/plugin-apply-comparison-order
Description: 🐊Putout plugin adds ability to apply comparison order
Author: coderaiser
Latest version: 1.4.1

# @putout/plugin-apply-comparison-order [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-comparison-order.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-comparison-order "npm"

> The result of evaluating an equality operator is always of type boolean based on whether the comparison is true.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply comparison order.
Checkout it 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/c61c94d2e1990f59b160aaf462f9a903/0855844b114079ec46098be6f3602dfdaa74290c). Merged to [`@putout/plugin-conditions`](https://www.npmjs.com/package/@putout/plugin-conditions).

## Install

```
npm i @putout/plugin-apply-comparison-order
```

## Rule

```json
{
    "rules": {
        "apply-comparison-order": "on"
    }
}
```

## ❌ Example of incorrect code

```js
3 === a;
3 < b;
```

## ✅ Example of correct code

```js
a === 3;
b > 3;
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout**| [`apply-comparison-order`](https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-comparison-order#readme)| ✅
⏣ **ESLint** | [`yoda`](https://eslint.org/docs/rules/yoda) | ½

## License

MIT
npm package: @putout/plugin-apply-consistent-blocks
Description: 🐊Putout plugin adds ability to apply consistent blocks
Author: coderaiser
Latest version: 1.2.1

# @putout/plugin-apply-consistent-blocks [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-consistent-blocks.svg?style=flconsistent-blocks&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-consistent-blocks "npm"

> A **block statement** is used to group zero or more statements. The block is delimited by a pair of braces ("curly braces") and contains a list of zero or more statements and declarations.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply consistent blocks. Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/9035db21bae7b6c76d1dc875d4c74828/07edbfd755060ae263949caf08b31aa43609375a). Merged to [@putout/plugin-conditions](https://www.npmjs.com/package/@putout/plugin-conditions).

## Install

```
npm i @putout/plugin-apply-consistent-blocks
```

## Rule

```json
{
    "rules": {
        "apply-consistent-blocks": "on"
    }
}
```

## ❌ Example of incorrect code

```js
if (a > 3) {
    m();
}

if (a > 3)
    b = 5;
else {
    b = 6;
}

if (a > 3)
    b = 5;
else {
    b = 6;
    fn();
}
```

## ✅ Example of correct code

```js
if (a > 3)
    m();

if (a > 3)
    b = 5;
else
    b = 6;

if (a > 3) {
    b = 5;
} else {
    b = 6;
    fn();
}
```

## License

MIT
npm package: @putout/plugin-apply-destructuring
Description: 🐊Putout plugin adds ability use destructuring on variable declarations
Author: coderaiser
Latest version: 10.1.1

# @putout/plugin-apply-destructuring [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-destructuring.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-destructuring"npm"

> 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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to use **destructuring** on variable declarations. Renamed to [`@putout/plugin-destructuring`](https://www.npmjs.com/package/@putout/plugin-destructuring).

## Install

```
npm i @putout/plugin-apply-destructuring
```

## Rules

- ✅ [object](#object);
- ✅ [array](#array);
- ✅ [falsy](#falsy);
- ✅ [convert-object-to-array](#convert-object-to-array);

## Config

Short:

```json
{
    "rules": {
        "apply-destructuring": "on"
    }
}
```

Full:

```json
{
    "rules": {
        "apply-destructuring/object": "on",
        "apply-destructuring/array": "on",
        "apply-destructuring/falsy": "on"
    }
}
```

## array

## ❌ Example of incorrect code

```js
const first = array[0];
```

## ✅ Example of correct code

```js
const [first] = array;
```

## object

## ❌ Example of incorrect code

```js
const name = user.name;

hello = world.hello;
```

## ✅ Example of correct code

```js
const {name} = user;

({hello} = world);
```

## falsy

Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/c9ed04b421d75ae39e58038fa6e14630/4c097e3173990ec7e5ebabbe2cedf8e952092ebf).

## ❌ Example of incorrect code

```js
const {maxElementsInOneLine} = {
    options,
};
```

## ✅ Example of correct code

```js
const {maxElementsInOneLine} = options;
```

## convert-object-to-array

Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/a1d26daf8bb83ee3ea1c0b62a6ad3afd/cef9b4d27c9dbb0d413a935b0359a6fe9b50364f).

## ❌ Example of incorrect code

```js
const {0: a, 1: b} = c;
```

## ✅ Example of correct code

```js
const [a, b] = c;
```

## License

MIT
npm package: @putout/plugin-apply-dot-notation
Description: 🐊Putout plugin applies dot notation
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-apply-dot-notation [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-dot-notation.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-dot-notation "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply dot notation. Checkout out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/d0702a7f5765c0f26788be18296eefca/a33f4501ce1e6018e6bb1b52ae0f554cb4483a05).

> Property accessors provide access to an object's properties by using the dot notation or the bracket notation.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors)

## Install

```
npm i @putout/plugin-apply-dot-notation
```

## Rule

```json
{
    "rules": {
        "apply-dot-notation": "on"
    }
}
```

## ❌ Example of incorrect code

```js
a.hello['world'];
```

## ✅ Example of correct code

```js
a.hello.world;
a[1];
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout** | [`apply-dot-notation`](https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-dot-notation#readme) | ✅
⏣ **ESLint** | [`dot-notation`](https://eslint.org/docs/latest/rules/dot-notation) | ✅
📖 **Blog** | [`Converting-Bracket-Notation-Dot-Notation`](https://steakenthusiast.github.io/2022/05/28/Deobfuscating-Javascript-via-AST-Manipulation-Converting-Bracket-Notation-Dot-Notation-for-Property-Accessors/) | ✅

## License

MIT
npm package: @putout/plugin-apply-early-return
Description: 🐊Putout plugin adds ability use apply early return
Author: coderaiser
Latest version: 3.0.1

# @putout/plugin-apply-early-return [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-early-return.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-early-return"npm"

> In short, an **early return** provides functionality so the result of a conditional statement can be returned as soon as a result is available, rather than wait until the rest of the function is run. Merged with [`@putout/plugin-return`](https://www.npmjs.com/package/@putout/plugin-return).
>
> (c) [dev.to](https://dev.to/jenniferlynparsons/early-returns-in-javascript-5hfb)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply **early return**.

## Install

```
npm i @putout/plugin-apply-early-return
```

## Rule

```json
{
    "rules": {
        "apply-early-return": "on"
    }
}
```

## ❌ Example of incorrect code

```js
function get(a) {
    let b = 0;
    
    if (a > 0)
        b = 5;
    else
        b = 7;
    
    return b;
}
```

## ✅ Example of correct code

```js
function get(a) {
    if (a > 0)
        return 5;
    
    return 7;
}
```

## License

MIT
npm package: @putout/plugin-apply-entries
Description: 🐊Putout plugin adds ability apply 'entries()'
Author: coderaiser
Latest version: 2.0.0

# @putout/plugin-apply-entries [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-entries.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-entries "npm"

> The `Object.entries()` static method returns an array of a given object's own enumerable string-keyed property key-value pairs..
>
> (c) [Object.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries)

> The entries() method of Array instances returns a new array iterator object that contains the key/value pairs for each index in the array.
>
> (c) [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply `entries()`.

While `entries()` does the same for `Object` and `Array`, if you for some reason confuse this to methods, and use `Object.entries()` on array, you will have `string`-indexes.

- ☝️ *Not bundled since it most likely will be bad for coverage*
- ☝️ *Requires additional configuration to work in ESLint and 🐊**Putout** as it is ESM module*

```js
for (const [index, value] of Object.entries(['a', 'b', 'c'])) {
    console.log(index === 1); // never true
}
```

So (thanks to [`@putout/plugin-declare`](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare#readme)), you can use:

```js
const {isArray} = Array;
const entries = (a) => isArray(a) ? a.entries() : Object.entries(a);

// entries called only once during loop initialization
for (const [index, value] of entries(['a', 'b', 'c'])) {
    console.log(index === 1); // never true
}
```

So instead of memorizing:

- ❌ `Array.entries()`;
- ❌ `Object.prototype.entries()`;
- ✅ `Array.prototype.entries()`;
- ✅ `Object.entries()`;

Just use:

- 🐊 `entries()`;

Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/0eb1e099e049559ef9f70ab426d7b8c9/438e8507b4f46020dc4dd5b7428d7eb7b71877e0).

## Install

```
npm i @putout/plugin-apply-entries
```

## Rule

```json
{
    "rules": {
        "apply-entries": "on"
    }
}
```

## ❌ Example of incorrect code

```js
for (const a of b.entries()) {}
```

## ✅ Example of correct code

```js
const {isArray} = Array;
const entries = (a) => isArray(a) ? a.entries() : Object.entries(a);

for (const a of entries(b)) {}
```

## License

MIT
npm package: @putout/plugin-apply-filter-boolean
Description: putout plugin adds ability to apply filter(Boolean)
Author: coderaiser
Latest version: 1.1.1

# @putout/plugin-apply-filter-boolean [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-filter-boolean.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-filter-boolean "npm"

`putout` plugin adds ability to apply `filter(Boolean)`. Better use [@putout/plugin-remove-useless-functions](https://github.com/coderaiser/putout/tree/v21.6.0/packages/plugin-remove-useless-functions).

## Install

```
npm i @putout/plugin-apply-filter-boolean
```

## Rule

```json
{
    "rules": {
        "apply-filter-boolean": "on"
    }
}
```

## ❌ Incorrect code example

```ts
array.filter((a) => a);
```

## ✅ Correct code Example

```ts
array.filter(Boolean);
```

## License

MIT
npm package: @putout/plugin-apply-flat-map
Description: 🐊Putout plugin adds ability to apply 'flatMap()'
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-apply-flat-map [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-flat-map.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-flat-map "npm"

> The `flatMap()` method returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level.
> It is identical to a `map()` followed by a `flat()` of depth 1 (`arr.map(...args).flat()`), but slightly more efficient than calling those two methods separately.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply `flatMap()`. Check out in [🐊**Putout Editor**](https://putout.cloudcmd.io/#/gist/0d3d44937de69ca266c4a11be5152eac/86af6566f93434ef86fdca919e57eaac7361a706).

## Install

```
npm i @putout/plugin-apply-flat-map
```

## Rule

```json
{
    "rules": {
        "apply-flat-map": "on"
    }
}
```

## ❌ Example of incorrect code

```js
array
    .map(getId)
    .flat();
```

## ✅ Example of correct code

```js
array.flatMap(getId);
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout** | [`apply-flat-map`](https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-flat-map#readme) | ✅
⏣ **ESLint** | [`unicorn/prefer-flat-map`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat-map.md) | ✅
🏛 **Rome** | [`useFlatMap`](https://docs.rome.tools/lint/rules/useflatmap/) | ✅

## License

MIT
npm package: @putout/plugin-apply-global-this
Description: 🐊Putout plugin adds ability to find and apply 'globalThis'
Author: coderaiser
Latest version: 1.0.1

# @putout/plugin-apply-global-this [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-global-this.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-global-this "npm"

> Historically, accessing the global object has required different syntax in different JavaScript environments. On the web you can use `window`, `self`, or frames - but in Web Workers only `self` will work. In Node.js none of these work, and you must instead use `global`
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and apply `globalThis`.

Check out in 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/c72c8e1b1d0c2b45fd0d15d837dcae52/c7f33d77d19efe962339debbcf20f68bf2159aee).

## Install

```
npm i @putout/plugin-apply-global-this
```

## Rule

```json
{
    "rules": {
        "apply-global-this": "on"
    }
}
```

### ❌ Example of incorrect code

```js
globalThis.__putout_debug = debugFn;
globalThis.CloudCmd = {};
```

### ✅ Example of correct code

```js
globalThis.__putout_debug = debugFn;
globalThis.CloudCmd = {};
```

### Comparison

Linter | Rule | Fix
-------|------|------------|
🐊 **Putout** | [`apply-global-this`](https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-global-this#readme) | ✅
⏣ **ESLint**  | [`no-node-globals`](https://docs.deno.com/lint/rules/no-node-globals/)  | ❌

## License

MIT
npm package: @putout/plugin-apply-if-condition
Description: 🐊Putout plugin adds ability apply if condition
Author: coderaiser
Latest version: 1.1.1

# @putout/plugin-apply-if-condition [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-if-condition.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-if-condition"npm"

> The `if` statement executes a statement if a specified condition is truthy.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply `if` condition. Merged to [`@putout/plugin-conditions`](https://www.npmjs.com/package/@putout/plugin-conditions).

## Install

```
npm i @putout/plugin-apply-if-condition
```

## Rule

Rule `apply-if-condition`:

## Rule

```json
{
    "rules": {
        "apply-if-condition": "on"
    }
}
```

## ❌ Example of incorrect code

```js
if (2 > 3);
    alert();
```

## ✅ Example of correct code

```js
if (2 > 3)
    alert();
```

## License

MIT
npm package: @putout/plugin-apply-is-array
Description: 🐊Putout plugin adds ability to apply Array.isArray()
Author: coderaiser
Latest version: 3.0.2

# @putout/plugin-apply-is-array [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-is-array.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-is-array "npm"

> The `Array.isArray()` method determines whether the passed value is an `Array`.
> When checking for `Array` instance, `Array.isArray()` is preferred over `instanceof` because it works through `iframes`.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply `Array.isArray()`. Fits good with [@putout/plugin-declare](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare#readme). Merged to [`@putout/plugin-types`](https://www.npmjs.com/package/@putout/plugin-types).

## Install

```
npm i @putout/plugin-apply-is-array
```

## Rule

```json
{
    "rules": {
        "apply-is-array": "on"
    }
}
```

## ❌ Example of incorrect code

```js
x instanceof Array;
```

## ✅ Example of correct code

```js
const {isArray} = Array;
isArray(x);
```

In case of using `inline` option:

```json
{
    "rules": {
        "apply-is-array": ["on", {
            "inline": true
        }]
    }
}
```

`Array.isArray` will be inlined:

```js
Array.isArray(x);
```

## License

MIT
npm package: @putout/plugin-apply-maybe
Description: 🐊Putout plugin applies Maybe monad
Author: coderaiser
Latest version: 1.2.1

# @putout/plugin-apply-maybe [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-maybe.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-maybe"npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin helps with `maybe` monad. Depends on [`@putout/declare`](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare#readme). Renamed to [`@putout/plugin-maybe`](https://www.npmjs.com/package/@putout/maybe).

## Install

```
npm i @putout/plugin-apply-maybe -D
```

## Rules

```json
{
    "rules": {
        "apply-maybe/array": "on",
        "apply-maybe/empty-array": "on",
        "apply-maybe/fn": "on"
    }
}
```

## array

### ❌ Example of incorrect code

```js
const array = isArray(a) ? a : [a];
```

### ✅ Example of correct code

```js
const maybeArray = (a) => isArray(a) ? a : [a];
const array = maybeArray(a);
```

## empty-array

### ❌ Example of incorrect code

```js
const array = !a ? [] : a;
```

### ✅ Example of correct code

```js
const maybeArray = (a) => !a ? [] : a;
const array = maybeEmptyArray(a);
```

## fn

### ❌ Example of incorrect code

```js
const fn = isFn(a) ? a : () => {};
```

### ✅ Example of correct code

```js
const noop = () => {};
const maybeFn = isFn(a) ? a : noop;
const fn = maybeFn(a);
```

## noop

### ❌ Example of incorrect code

```js
const fn = f || (() => {});
```

### ✅ Example of correct code

```js
const noop = () => {};
const fn = fn || noop;
```

## License

MIT
npm package: @putout/plugin-apply-montag
Description: putout plugin adds ability apply 'montag'
Author: coderaiser
Latest version: 1.1.1

# @putout/plugin-apply-montag [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-montag.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-montag"npm"


> Format multiline strings using tagged templates, instead of puting all lines into an array and joining to a string.
>
> (c) [**Montag**](https://github.com/coderaiser/montag)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply [**Montag**](https://github.com/coderaiser/montag). Renamed to [@putout/plugin-montag](https://www.npmjs.com/package/@putout/plugin-montag).

## Install

```
npm i @putout/plugin-apply-montag
```

## Rule

```json
{
    "rules": {
        "apply-montag": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const a = [
    'hello',
    'world',
].join('\n');
```

## ✅ Example of correct code

```js
const a = montag`
    hello
    world
`;
```

## License

MIT
npm package: @putout/plugin-apply-nullish-coalescing
Description: 🐊Putout plugin add ability to apply nullish coalescing operator (??)
Author: coderaiser
Latest version: 2.0.0

# @putout/plugin-apply-nullish-coalescing [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-nullish-coalescing.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-nullish-coalescing"npm"

> The **nullish coalescing** operator (`??`) is a logical operator that returns its right-hand side operand when its left-hand side operand is `null` or `undefined`, and otherwise returns its left-hand side operand.
> This can be seen as a special case of the logical OR (`||`) operator, which returns the right-hand side operand if the left operand is any falsy value, not only `null` or `undefined`. In other words, if you use `||` to provide some default value to another variable foo, you may encounter unexpected behaviors if you consider some falsy values as usable (e.g., `''` or `0`).
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin apply **nullish coalescing**.

## Install

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

## Rule

```json
{
    "rules": {
        "apply-nullish-coalescing": "on"
    }
}
```

## ❌ Example of incorrect code

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

## ✅ Example of correct code

```js
const result = result ?? 'hello';
```

## License

MIT