File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ var setPrototypeOf = require("es5-ext/object/set-prototype-of")
8
8
var defineProperty = Object . defineProperty , ArrayIterator ;
9
9
10
10
ArrayIterator = module . exports = function ( arr , kind ) {
11
- if ( ! ( this instanceof ArrayIterator ) ) return new ArrayIterator ( arr , kind ) ;
11
+ if ( ! ( this instanceof ArrayIterator ) ) throw new TypeError ( "Constructor requires 'new'" ) ;
12
12
Iterator . call ( this , arr ) ;
13
13
if ( ! kind ) kind = "value" ;
14
14
else if ( contains . call ( kind , "key+value" ) ) kind = "key+value" ;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ var clear = require("es5-ext/array/#/clear")
11
11
var defineProperty = Object . defineProperty , defineProperties = Object . defineProperties , Iterator ;
12
12
13
13
module . exports = Iterator = function ( list , context ) {
14
- if ( ! ( this instanceof Iterator ) ) return new Iterator ( list , context ) ;
14
+ if ( ! ( this instanceof Iterator ) ) throw new TypeError ( "Constructor requires 'new'" ) ;
15
15
defineProperties ( this , {
16
16
__list__ : d ( "w" , value ( list ) ) ,
17
17
__context__ : d ( "w" , context ) ,
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ var setPrototypeOf = require("es5-ext/object/set-prototype-of")
10
10
var defineProperty = Object . defineProperty , StringIterator ;
11
11
12
12
StringIterator = module . exports = function ( str ) {
13
- if ( ! ( this instanceof StringIterator ) ) return new StringIterator ( str ) ;
13
+ if ( ! ( this instanceof StringIterator ) ) throw new TypeError ( "Constructor requires 'new'" ) ;
14
14
str = String ( str ) ;
15
15
Iterator . call ( this , str ) ;
16
16
defineProperty ( this , "__length__" , d ( "" , str . length ) ) ;
You can’t perform that action at this time.
0 commit comments