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.

18 lines
411 B

2 years ago
  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. };