暫無描述

12345678910111213141516171819202122
  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. 'use strict';
  8. var typeOf = require('kind-of');
  9. module.exports = function isNumber(num) {
  10. var type = typeOf(num);
  11. if (type === 'string') {
  12. if (!num.trim()) return false;
  13. } else if (type !== 'number') {
  14. return false;
  15. }
  16. return (num - num + 1) >= 0;
  17. };