]> gerrit.simantics Code Review - simantics/district.git/blob - ensure-natural-number.js
af9b4d77c29efe4fb379a8bcc348988727a673ec
[simantics/district.git] / ensure-natural-number.js
1 'use strict';
2
3 var isNatural = require('../number/is-natural');
4
5 module.exports = function (arg) {
6         var num = Number(arg);
7         if (!isNatural(num)) throw new TypeError(arg + " is not a natural number");
8         return num;
9 };