index.js 420 B

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