react-room-occupancy-input
Version:
React.js component for specifying a hotel room occupancy: how many adults, how many kids, how old kids are
21 lines (18 loc) • 548 B
JavaScript
(function () {
'use strict';
if (!Number.isInteger) {
Number.isInteger = function isInteger (nVal) {
return (
(typeof nVal === 'number') &&
isFinite(nVal) &&
(nVal > -9007199254740992) &&
(nVal < 9007199254740992) &&
(Math.floor(nVal) === nVal)
);
};
}
module.exports = function (x) {
var floatX = parseFloat(x);
return Number.isInteger(floatX) && (floatX >= 0) && (floatX <= 11);
};
}());