isArguments.js 422 B

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