ensure-natural-number-value.js 466 B

123456789101112
  1. 'use strict';
  2. module.exports = function (t, a) {
  3. a.throws(function () { t(undefined); }, TypeError, "Undefined");
  4. a.throws(function () { t(null); }, TypeError, "Null");
  5. a(t(2), 2, "Number");
  6. a.throws(function () { t(-2); }, TypeError, "Negative");
  7. a.throws(function () { t(2.34); }, TypeError, "Float");
  8. a(t('23'), 23, "Numeric string");
  9. a.throws(function () { t(NaN); }, TypeError, "NaN");
  10. a.throws(function () { t(Infinity); }, TypeError, "Infinity");
  11. };