diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-27 19:59:29 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-30 13:45:38 +0100 |
commit | 1f9a5ae7aadd073ac61933226687a4483f8eccf4 (patch) | |
tree | 2d07023ce21a0aa0339344ea513bce8490c27757 /lib/events.js | |
parent | 7fc5980cfe79c9b7ff19837397823a583c9fd8fe (diff) | |
download | node-new-1f9a5ae7aadd073ac61933226687a4483f8eccf4.tar.gz |
lib: use static Number properties from primordials
PR-URL: https://github.com/nodejs/node/pull/30686
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'lib/events.js')
-rw-r--r-- | lib/events.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/events.js b/lib/events.js index f8c268ee1c..a09333af44 100644 --- a/lib/events.js +++ b/lib/events.js @@ -24,6 +24,7 @@ const { Array, MathMin, + NumberIsNaN, ObjectCreate, ObjectDefineProperty, ObjectGetPrototypeOf, @@ -79,7 +80,7 @@ ObjectDefineProperty(EventEmitter, 'defaultMaxListeners', { return defaultMaxListeners; }, set: function(arg) { - if (typeof arg !== 'number' || arg < 0 || Number.isNaN(arg)) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { throw new ERR_OUT_OF_RANGE('defaultMaxListeners', 'a non-negative number', arg); @@ -102,7 +103,7 @@ EventEmitter.init = function() { // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || Number.isNaN(n)) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { throw new ERR_OUT_OF_RANGE('n', 'a non-negative number', n); } this._maxListeners = n; |