You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
780 B
52 lines
780 B
/**
|
|
*
|
|
* VALIDATE: nonnegative-integer
|
|
*
|
|
*
|
|
* DESCRIPTION:
|
|
* - Validates if a value is a nonnegative integer.
|
|
*
|
|
*
|
|
* NOTES:
|
|
* [1]
|
|
*
|
|
*
|
|
* TODO:
|
|
* [1]
|
|
*
|
|
*
|
|
* LICENSE:
|
|
* MIT
|
|
*
|
|
* Copyright (c) 2015. Athan Reines.
|
|
*
|
|
*
|
|
* AUTHOR:
|
|
* Athan Reines. kgryte@gmail.com. 2015.
|
|
*
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
// MODULES //
|
|
|
|
var isInteger = require( 'validate.io-integer' );
|
|
|
|
|
|
// IS NONNEGATIVE INTEGER //
|
|
|
|
/**
|
|
* FUNCTION: isNonNegativeInteger( value )
|
|
* Validates if a value is a nonnegative integer.
|
|
*
|
|
* @param {*} value - value to be validated
|
|
* @returns {Boolean} boolean indicating if a value is a nonnegative integer
|
|
*/
|
|
function isNonNegativeInteger( value ) {
|
|
return isInteger( value ) && value >= 0;
|
|
} // end FUNCTION isNonNegativeInteger()
|
|
|
|
|
|
// EXPORTS //
|
|
|
|
module.exports = isNonNegativeInteger;
|
|
|