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.
53 lines
752 B
53 lines
752 B
5 years ago
|
/**
|
||
|
*
|
||
|
* VALIDATE: positive-integer
|
||
|
*
|
||
|
*
|
||
|
* DESCRIPTION:
|
||
|
* - Validates if a value is a positive 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 POSITIVE INTEGER //
|
||
|
|
||
|
/**
|
||
|
* FUNCTION: isPositiveInteger( value )
|
||
|
* Validates if a value is a positive integer.
|
||
|
*
|
||
|
* @param {*} value - value to be validated
|
||
|
* @returns {Boolean} boolean indicating if a value is a positive integer
|
||
|
*/
|
||
|
function isPositiveInteger( value ) {
|
||
|
return isInteger( value ) && value > 0;
|
||
|
} // end FUNCTION isPositiveInteger()
|
||
|
|
||
|
|
||
|
// EXPORTS //
|
||
|
|
||
|
module.exports = isPositiveInteger;
|