Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
976 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var hasToStringTag = require('has-tostringtag/shams')();
|
---|
| 4 | var callBound = require('call-bind/callBound');
|
---|
| 5 |
|
---|
| 6 | var $toString = callBound('Object.prototype.toString');
|
---|
| 7 |
|
---|
| 8 | var isStandardArguments = function isArguments(value) {
|
---|
| 9 | if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
|
---|
| 10 | return false;
|
---|
| 11 | }
|
---|
| 12 | return $toString(value) === '[object Arguments]';
|
---|
| 13 | };
|
---|
| 14 |
|
---|
| 15 | var isLegacyArguments = function isArguments(value) {
|
---|
| 16 | if (isStandardArguments(value)) {
|
---|
| 17 | return true;
|
---|
| 18 | }
|
---|
| 19 | return value !== null &&
|
---|
| 20 | typeof value === 'object' &&
|
---|
| 21 | typeof value.length === 'number' &&
|
---|
| 22 | value.length >= 0 &&
|
---|
| 23 | $toString(value) !== '[object Array]' &&
|
---|
| 24 | $toString(value.callee) === '[object Function]';
|
---|
| 25 | };
|
---|
| 26 |
|
---|
| 27 | var supportsStandardArguments = (function () {
|
---|
| 28 | return isStandardArguments(arguments);
|
---|
| 29 | }());
|
---|
| 30 |
|
---|
| 31 | isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
|
---|
| 32 |
|
---|
| 33 | module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.