index.js 396 B

12345678910111213141516171819
  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 !== 'number' && type !== 'string') {
  12. return false;
  13. }
  14. var n = +num;
  15. return (n - n + 1) >= 0 && num !== '';
  16. };