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.

123456789101112131415161718
  1. /*!
  2. * is-number <https://github.com/jonschlinkert/is-number>
  3. *
  4. * Copyright (c) 2014-present, Jon Schlinkert.
  5. * Released under the MIT License.
  6. */
  7. 'use strict';
  8. module.exports = function(num) {
  9. if (typeof num === 'number') {
  10. return num - num === 0;
  11. }
  12. if (typeof num === 'string' && num.trim() !== '') {
  13. return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
  14. }
  15. return false;
  16. };