subtract.js 347 B

123456789101112
  1. 'use strict';
  2. var $TypeError = require('es-errors/type');
  3. // https://262.ecma-international.org/11.0/#sec-numeric-types-number-subtract
  4. module.exports = function NumberSubtract(x, y) {
  5. if (typeof x !== 'number' || typeof y !== 'number') {
  6. throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
  7. }
  8. return x - y;
  9. };