isArguments.js 437 B

1234567891011121314151617
  1. var toString = Object.prototype.toString;
  2. module.exports = function isArguments(value) {
  3. var str = toString.call(value);
  4. var isArguments = str === '[object Arguments]';
  5. if (!isArguments) {
  6. isArguments = str !== '[object Array]'
  7. && value !== null
  8. && typeof value === 'object'
  9. && typeof value.length === 'number'
  10. && value.length >= 0
  11. && toString.call(value.callee) === '[object Function]';
  12. }
  13. return isArguments;
  14. };