You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It changes Number constructor behavior and breaks Chai.js assertion library's.
Example code: 1.js
'use strict';require('core-js');varnumberObject=newNumber(1);console.log(numberObject);// [Number: 1]console.log('\n');console.log(numberObject.constructor(numberObject));// [Number: 1], should be 1console.log(Number(numberObject));// 1console.log(Number.prototype.constructor(numberObject));// 1console.log('\n');console.log(typeofnumberObject.constructor(numberObject));// object, should be numberconsole.log(typeofNumber(numberObject));// numberconsole.log(typeofNumber.prototype.constructor(numberObject));/ number
console.log('\n');console.log(numberObject.constructor===Number);// trueconsole.log(numberObject.constructor===Number.prototype.constructor);// trueconsole.log('\n');console.log(Number.toString());// function Number() { [native code] }console.log(numberObject.constructor.toString());// function Number() { [native code] }console.log('\n');console.log(1instanceofNumber);// falseconsole.log(Object.prototype.toString.call(1));// [object Number]console.log(numberObjectinstanceofNumber);// trueconsole.log(Object.prototype.toString.call(numberObject));// [object Number]console.log('\n');
Output of node 1.js
[Number: 1]
[Number: 1] // should be 1
1
1
object // should be number
number
number
true
true
function Number() { [native code] }
function Number() { [native code] }
false
[object Number]
true
[object Number]
The text was updated successfully, but these errors were encountered:
It changes Number constructor behavior and breaks Chai.js assertion library's.
Example code:
1.js
Output of
node 1.js
The text was updated successfully, but these errors were encountered: