index.js 411 B

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. };