@putout/plugin-add-missing-new

1.0.2 • Public • Published

@putout/plugin-add-missing-new NPM version

The Set constructor lets you create Set objects that store unique values of any type, whether primitive values or object references.

(c) MDN

🐊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 when called without new like this:

Uncaught TypeError: Constructor Set requires 'new'

Part of @putout/plugin-new.

Install

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

Rule

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

Example of incorrect code

const map = Map();

Example of correct code

const map = new Map();

License

MIT

Package Sidebar

Install

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

Weekly Downloads

51

Version

1.0.2

License

MIT

Unpacked Size

4.76 kB

Total Files

4

Last publish

Collaborators

  • coderaiser