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")
88var defineProperty = Object . defineProperty , ArrayIterator ;
99
1010ArrayIterator = 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'" ) ;
1212 Iterator . call ( this , arr ) ;
1313 if ( ! kind ) kind = "value" ;
1414 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")
1111var defineProperty = Object . defineProperty , defineProperties = Object . defineProperties , Iterator ;
1212
1313module . 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'" ) ;
1515 defineProperties ( this , {
1616 __list__ : d ( "w" , value ( list ) ) ,
1717 __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")
1010var defineProperty = Object . defineProperty , StringIterator ;
1111
1212StringIterator = module . exports = function ( str ) {
13- if ( ! ( this instanceof StringIterator ) ) return new StringIterator ( str ) ;
13+ if ( ! ( this instanceof StringIterator ) ) throw new TypeError ( "Constructor requires 'new'" ) ;
1414 str = String ( str ) ;
1515 Iterator . call ( this , str ) ;
1616 defineProperty ( this , "__length__" , d ( "" , str . length ) ) ;
You can’t perform that action at this time.
0 commit comments