isNumbery.js 313 B

1234567891011
  1. 'use strict';
  2. /**
  3. * Check whether it's a number or a number-like string:
  4. * i.e. when coerced to a number it == itself.
  5. *
  6. * @param {string | number} value
  7. */
  8. module.exports = function isNumbery(value) {
  9. return value.toString().trim().length !== 0 && Number(value) == value; // eslint-disable-line eqeqeq
  10. };