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.
46 lines
687 B
46 lines
687 B
5 years ago
|
/**
|
||
|
*
|
||
|
* VALIDATE: number
|
||
|
*
|
||
|
*
|
||
|
* DESCRIPTION:
|
||
|
* - Validates if a value is a number.
|
||
|
*
|
||
|
*
|
||
|
* NOTES:
|
||
|
* [1]
|
||
|
*
|
||
|
*
|
||
|
* TODO:
|
||
|
* [1]
|
||
|
*
|
||
|
*
|
||
|
* LICENSE:
|
||
|
* MIT
|
||
|
*
|
||
|
* Copyright (c) 2014. Athan Reines.
|
||
|
*
|
||
|
*
|
||
|
* AUTHOR:
|
||
|
* Athan Reines. kgryte@gmail.com. 2014.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
/**
|
||
|
* FUNCTION: isNumber( value )
|
||
|
* Validates if a value is a number.
|
||
|
*
|
||
|
* @param {*} value - value to be validated
|
||
|
* @returns {Boolean} boolean indicating whether value is a number
|
||
|
*/
|
||
|
function isNumber( value ) {
|
||
|
return ( typeof value === 'number' || Object.prototype.toString.call( value ) === '[object Number]' ) && value.valueOf() === value.valueOf();
|
||
|
} // end FUNCTION isNumber()
|
||
|
|
||
|
|
||
|
// EXPORTS //
|
||
|
|
||
|
module.exports = isNumber;
|