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