source: trip-planner-front/node_modules/is-arguments/index.js@ 76712b2

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
Line 
1'use strict';
2
3var hasToStringTag = require('has-tostringtag/shams')();
4var callBound = require('call-bind/callBound');
5
6var $toString = callBound('Object.prototype.toString');
7
8var 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
15var 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
27var supportsStandardArguments = (function () {
28 return isStandardArguments(arguments);
29}());
30
31isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
32
33module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
Note: See TracBrowser for help on using the repository browser.