source: imaps-frontend/node_modules/es-abstract/2020/Number/divide.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 561 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var isFinite = require('../../helpers/isFinite');
6var isNaN = require('../../helpers/isNaN');
7
8// https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide
9
10module.exports = function NumberDivide(x, y) {
11 if (typeof x !== 'number' || typeof y !== 'number') {
12 throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
13 }
14 if (isNaN(x) || isNaN(y) || (!isFinite(x) && !isFinite(y))) {
15 return NaN;
16 }
17 // shortcut for the actual spec mechanics
18 return x / y;
19};
Note: See TracBrowser for help on using the repository browser.