Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
420 bytes
|
Line | |
---|
1 | /*!
|
---|
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 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.