@putout/plugin-add-missing-new
🐊Putout plugin adds ability to add missing operator 'new'
Last updated 5 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-add-missing-new 
SYNC missed versions from official npm registry.

@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

Current Tags

  • 1.0.2                                ...           latest (5 years ago)

3 Versions

  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE