File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag =
4
4
var toStr = Object . prototype . toString ;
5
5
6
6
var isStandardArguments = function isArguments ( value ) {
7
- if ( hasToStringTag && value && Symbol . toStringTag in value ) {
7
+ if ( hasToStringTag && value && typeof value === 'object' && Symbol . toStringTag in value ) {
8
8
return false ;
9
9
}
10
10
return toStr . call ( value ) === '[object Arguments]' ;
Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag =
7
7
test ( 'primitives' , function ( t ) {
8
8
t . notOk ( isArguments ( [ ] ) , 'array is not arguments' ) ;
9
9
t . notOk ( isArguments ( { } ) , 'object is not arguments' ) ;
10
- t . notOk ( isArguments ( '' ) , 'string is not arguments' ) ;
10
+ t . notOk ( isArguments ( '' ) , 'empty string is not arguments' ) ;
11
+ t . notOk ( isArguments ( 'foo' ) , 'string is not arguments' ) ;
11
12
t . notOk ( isArguments ( { length : 2 } ) , 'naive array-like is not arguments' ) ;
12
13
t . end ( ) ;
13
14
} ) ;
You can’t perform that action at this time.
0 commit comments