aswi2020vldc-gitlab/templetes/node_modules/is-number/index.js @ 2aa583fe
1 | 3a515b92 | cagy | /*!
|
---|---|---|---|
2 | * is-number <https://github.com/jonschlinkert/is-number>
|
||
3 | *
|
||
4 | * Copyright (c) 2014-2015, Jon Schlinkert.
|
||
5 | * Licensed under the MIT License.
|
||
6 | */
|
||
7 | |||
8 | 'use strict'; |
||
9 | |||
10 | var typeOf = require('kind-of'); |
||
11 | |||
12 | module.exports = function isNumber(num) { |
||
13 | var type = typeOf(num); |
||
14 | |||
15 | if (type === 'string') { |
||
16 | if (!num.trim()) return false; |
||
17 | } else if (type !== 'number') { |
||
18 | return false; |
||
19 | }
|
||
20 | |||
21 | return (num - num + 1) >= 0; |
||
22 | };
|