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
686 B
52 lines
686 B
/**
|
|
*
|
|
* VALIDATE: integer
|
|
*
|
|
*
|
|
* DESCRIPTION:
|
|
* - Validates if a value is an integer.
|
|
*
|
|
*
|
|
* NOTES:
|
|
* [1]
|
|
*
|
|
*
|
|
* TODO:
|
|
* [1]
|
|
*
|
|
*
|
|
* LICENSE:
|
|
* MIT
|
|
*
|
|
* Copyright (c) 2014. Athan Reines.
|
|
*
|
|
*
|
|
* AUTHOR:
|
|
* Athan Reines. kgryte@gmail.com. 2014.
|
|
*
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
// MODULES //
|
|
|
|
var isNumber = require( 'validate.io-number' );
|
|
|
|
|
|
// ISINTEGER //
|
|
|
|
/**
|
|
* FUNCTION: isInteger( value )
|
|
* Validates if a value is an integer.
|
|
*
|
|
* @param {Number} value - value to be validated
|
|
* @returns {Boolean} boolean indicating whether value is an integer
|
|
*/
|
|
function isInteger( value ) {
|
|
return isNumber( value ) && value%1 === 0;
|
|
} // end FUNCTION isInteger()
|
|
|
|
|
|
// EXPORTS //
|
|
|
|
module.exports = isInteger;
|
|
|