2017-08-14 05:01:11 +02:00
|
|
|
"use strict";
|
|
|
|
|
2018-09-20 02:56:13 +02:00
|
|
|
var isNatural = require("../number/is-natural")
|
|
|
|
, toShortString = require("../to-short-string-representation");
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
|
|
module.exports = function (arg) {
|
|
|
|
var num = Number(arg);
|
2018-09-20 02:56:13 +02:00
|
|
|
if (!isNatural(num)) throw new TypeError(toShortString(arg) + " is not a natural number");
|
2017-08-14 05:01:11 +02:00
|
|
|
return num;
|
|
|
|
};
|