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.
13 lines
344 B
13 lines
344 B
import trim from './trim';
|
|
|
|
/**
|
|
* @description: 判断是否可以转number
|
|
* @param {String|Number} value
|
|
* @return {boolean}
|
|
* @example isNumber('5') // true
|
|
*/
|
|
export default function isNumber(value) {
|
|
if (typeof value === 'number') return true;
|
|
if (typeof value === 'string' && trim(value)) return !isNaN(value);
|
|
return false;
|
|
}
|
|
|