1
0

ensure-natural-number.js 216 B

123456789
  1. 'use strict';
  2. var isNatural = require('../number/is-natural');
  3. module.exports = function (arg) {
  4. var num = Number(arg);
  5. if (!isNatural(num)) throw new TypeError(arg + " is not a natural number");
  6. return num;
  7. };