956662fcbf18b6f739641d477afaae625a9b4ed5e4eab5f81e9fbf1bbfc0eae6ae90d16fd16e70e6e5499b88cc7d5a0746765e807e5a720d867476975ee8be 507 B

123456789101112131415161718192021
  1. /*!
  2. * is-number <https://github.com/jonschlinkert/is-number>
  3. *
  4. * Copyright (c) 2014-2017, Jon Schlinkert.
  5. * Released under the MIT License.
  6. */
  7. 'use strict';
  8. module.exports = function isNumber(num) {
  9. var type = typeof num;
  10. if (type === 'string' || num instanceof String) {
  11. // an empty string would be coerced to true with the below logic
  12. if (!num.trim()) return false;
  13. } else if (type !== 'number' && !(num instanceof Number)) {
  14. return false;
  15. }
  16. return (num - num + 1) >= 0;
  17. };