@putout/plugin-convert-typeof-to-is-type

2.0.1 • Public • Published

@putout/plugin-convert-typeof-to-is-type NPM version

The typeof operator returns a string indicating the type of the unevaluated operand.

(c) MDN

🐊Putout plugin adds ability to convert typeof to is type. Merged to @putout/plugin-types.

Install

npm i @putout/plugin-convert-typeof-to-is-type -D

Rule

{
    "rules": {
        "convert-typeof-to-is-type": "on"
    }
}

Example of incorrect code

if (typeof a === 'boolean')
    return x;

Example of correct code

const isBool = (a) => typeof a === 'boolean';

if (isBool(a))
    return x;

License

MIT

Package Sidebar

Install

npm i @putout/plugin-convert-typeof-to-is-type

Weekly Downloads

1,453

Version

2.0.1

License

MIT

Unpacked Size

5.08 kB

Total Files

4

Last publish

Collaborators

  • coderaiser