is_arguments.js 641 B

123456789101112131415161718192021
  1. var supportsArgumentsClass = (function(){
  2. return Object.prototype.toString.call(arguments)
  3. })() == '[object Arguments]';
  4. exports = module.exports = supportsArgumentsClass ? supported : unsupported;
  5. exports.supported = supported;
  6. function supported(object) {
  7. return Object.prototype.toString.call(object) == '[object Arguments]';
  8. };
  9. exports.unsupported = unsupported;
  10. function unsupported(object){
  11. return object &&
  12. typeof object == 'object' &&
  13. typeof object.length == 'number' &&
  14. Object.prototype.hasOwnProperty.call(object, 'callee') &&
  15. !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
  16. false;
  17. };