@@ -2289,6 +2289,8 @@ var INTRINSICS = {
2289
2289
'%AsyncIteratorPrototype%' : needsEval ,
2290
2290
'%Atomics%' : typeof Atomics === 'undefined' ? undefined : Atomics ,
2291
2291
'%BigInt%' : typeof BigInt === 'undefined' ? undefined : BigInt ,
2292
+ '%BigInt64Array%' : typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array ,
2293
+ '%BigUint64Array%' : typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array ,
2292
2294
'%Boolean%' : Boolean ,
2293
2295
'%DataView%' : typeof DataView === 'undefined' ? undefined : DataView ,
2294
2296
'%Date%' : Date ,
@@ -2344,6 +2346,14 @@ var INTRINSICS = {
2344
2346
'%WeakSet%' : typeof WeakSet === 'undefined' ? undefined : WeakSet
2345
2347
} ;
2346
2348
2349
+ try {
2350
+ null . error ; // eslint-disable-line no-unused-expressions
2351
+ } catch ( e ) {
2352
+ // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
2353
+ var errorProto = getProto ( getProto ( e ) ) ;
2354
+ INTRINSICS [ '%Error.prototype%' ] = errorProto ;
2355
+ }
2356
+
2347
2357
var doEval = function doEval ( name ) {
2348
2358
var value ;
2349
2359
if ( name === '%AsyncFunction%' ) {
@@ -2429,6 +2439,7 @@ var $concat = bind.call(Function.call, Array.prototype.concat);
2429
2439
var $spliceApply = bind . call ( Function . apply , Array . prototype . splice ) ;
2430
2440
var $replace = bind . call ( Function . call , String . prototype . replace ) ;
2431
2441
var $strSlice = bind . call ( Function . call , String . prototype . slice ) ;
2442
+ var $exec = bind . call ( Function . call , RegExp . prototype . exec ) ;
2432
2443
2433
2444
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
2434
2445
var rePropName = / [ ^ % . [ \] ] + | \[ (?: ( - ? \d + (?: \. \d + ) ? ) | ( [ " ' ] ) ( (?: (? ! \2) [ ^ \\ ] | \\ .) * ?) \2) \] | (? = (?: \. | \[ \] ) (?: \. | \[ \] | % $ ) ) / g;
@@ -2484,6 +2495,9 @@ module.exports = function GetIntrinsic(name, allowMissing) {
2484
2495
throw new $TypeError ( '"allowMissing" argument must be a boolean' ) ;
2485
2496
}
2486
2497
2498
+ if ( $exec ( / ^ % ? [ ^ % ] * % ? $ / , name ) === null ) {
2499
+ throw new $SyntaxError ( '`%` may not be present anywhere but at the beginning and end of the intrinsic name' ) ;
2500
+ }
2487
2501
var parts = stringToPath ( name ) ;
2488
2502
var intrinsicBaseName = parts . length > 0 ? parts [ 0 ] : '' ;
2489
2503
@@ -2713,8 +2727,9 @@ function addNumericSeparator(num, str) {
2713
2727
return $replace . call ( str , sepRegex , '$&_' ) ;
2714
2728
}
2715
2729
2716
- var inspectCustom = __nccwpck_require__ ( 7265 ) . custom ;
2717
- var inspectSymbol = inspectCustom && isSymbol ( inspectCustom ) ? inspectCustom : null ;
2730
+ var utilInspect = __nccwpck_require__ ( 7265 ) ;
2731
+ var inspectCustom = utilInspect . custom ;
2732
+ var inspectSymbol = isSymbol ( inspectCustom ) ? inspectCustom : null ;
2718
2733
2719
2734
module . exports = function inspect_ ( obj , options , depth , seen ) {
2720
2735
var opts = options || { } ;
@@ -2804,7 +2819,7 @@ module.exports = function inspect_(obj, options, depth, seen) {
2804
2819
return inspect_ ( value , opts , depth + 1 , seen ) ;
2805
2820
}
2806
2821
2807
- if ( typeof obj === 'function' ) {
2822
+ if ( typeof obj === 'function' && ! isRegExp ( obj ) ) { // in older engines, regexes are callable
2808
2823
var name = nameOf ( obj ) ;
2809
2824
var keys = arrObjKeys ( obj , inspect ) ;
2810
2825
return '[Function' + ( name ? ': ' + name : ' (anonymous)' ) + ']' + ( keys . length > 0 ? ' { ' + $join . call ( keys , ', ' ) + ' }' : '' ) ;
@@ -2834,31 +2849,35 @@ module.exports = function inspect_(obj, options, depth, seen) {
2834
2849
}
2835
2850
if ( isError ( obj ) ) {
2836
2851
var parts = arrObjKeys ( obj , inspect ) ;
2837
- if ( 'cause' in obj && ! isEnumerable . call ( obj , 'cause' ) ) {
2852
+ if ( ! ( 'cause' in Error . prototype ) && 'cause' in obj && ! isEnumerable . call ( obj , 'cause' ) ) {
2838
2853
return '{ [' + String ( obj ) + '] ' + $join . call ( $concat . call ( '[cause]: ' + inspect ( obj . cause ) , parts ) , ', ' ) + ' }' ;
2839
2854
}
2840
2855
if ( parts . length === 0 ) { return '[' + String ( obj ) + ']' ; }
2841
2856
return '{ [' + String ( obj ) + '] ' + $join . call ( parts , ', ' ) + ' }' ;
2842
2857
}
2843
2858
if ( typeof obj === 'object' && customInspect ) {
2844
- if ( inspectSymbol && typeof obj [ inspectSymbol ] === 'function' ) {
2845
- return obj [ inspectSymbol ] ( ) ;
2859
+ if ( inspectSymbol && typeof obj [ inspectSymbol ] === 'function' && utilInspect ) {
2860
+ return utilInspect ( obj , { depth : maxDepth - depth } ) ;
2846
2861
} else if ( customInspect !== 'symbol' && typeof obj . inspect === 'function' ) {
2847
2862
return obj . inspect ( ) ;
2848
2863
}
2849
2864
}
2850
2865
if ( isMap ( obj ) ) {
2851
2866
var mapParts = [ ] ;
2852
- mapForEach . call ( obj , function ( value , key ) {
2853
- mapParts . push ( inspect ( key , obj , true ) + ' => ' + inspect ( value , obj ) ) ;
2854
- } ) ;
2867
+ if ( mapForEach ) {
2868
+ mapForEach . call ( obj , function ( value , key ) {
2869
+ mapParts . push ( inspect ( key , obj , true ) + ' => ' + inspect ( value , obj ) ) ;
2870
+ } ) ;
2871
+ }
2855
2872
return collectionOf ( 'Map' , mapSize . call ( obj ) , mapParts , indent ) ;
2856
2873
}
2857
2874
if ( isSet ( obj ) ) {
2858
2875
var setParts = [ ] ;
2859
- setForEach . call ( obj , function ( value ) {
2860
- setParts . push ( inspect ( value , obj ) ) ;
2861
- } ) ;
2876
+ if ( setForEach ) {
2877
+ setForEach . call ( obj , function ( value ) {
2878
+ setParts . push ( inspect ( value , obj ) ) ;
2879
+ } ) ;
2880
+ }
2862
2881
return collectionOf ( 'Set' , setSize . call ( obj ) , setParts , indent ) ;
2863
2882
}
2864
2883
if ( isWeakMap ( obj ) ) {
0 commit comments