isInteger.js 303 B

1234567891011121314
  1. var isArray = require('./isArray')
  2. var isNull = require('./isNull')
  3. /**
  4. * 判断是否整数
  5. *
  6. * @param {Number, String} number 数值
  7. * @return {Boolean}
  8. */
  9. var isInteger = function (obj) {
  10. return !isNull(obj) && !isNaN(obj) && !isArray(obj) && obj % 1 === 0
  11. }
  12. module.exports = isInteger