mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
34 lines
976 B
JavaScript
34 lines
976 B
JavaScript
|
'use strict';
|
||
|
|
||
|
var hasToStringTag = require('has-tostringtag/shams')();
|
||
|
var callBound = require('call-bind/callBound');
|
||
|
|
||
|
var $toString = callBound('Object.prototype.toString');
|
||
|
|
||
|
var isStandardArguments = function isArguments(value) {
|
||
|
if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
|
||
|
return false;
|
||
|
}
|
||
|
return $toString(value) === '[object Arguments]';
|
||
|
};
|
||
|
|
||
|
var isLegacyArguments = function isArguments(value) {
|
||
|
if (isStandardArguments(value)) {
|
||
|
return true;
|
||
|
}
|
||
|
return value !== null &&
|
||
|
typeof value === 'object' &&
|
||
|
typeof value.length === 'number' &&
|
||
|
value.length >= 0 &&
|
||
|
$toString(value) !== '[object Array]' &&
|
||
|
$toString(value.callee) === '[object Function]';
|
||
|
};
|
||
|
|
||
|
var supportsStandardArguments = (function () {
|
||
|
return isStandardArguments(arguments);
|
||
|
}());
|
||
|
|
||
|
isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
|
||
|
|
||
|
module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
|