diff --git a/spec.html b/spec.html
index 42001c5..738324d 100644
--- a/spec.html
+++ b/spec.html
@@ -113,13 +113,12 @@
Operations on Iterator Objects
GetIteratorDirect (
- _obj_: an ECMAScript language value,
+ _obj_: an Object,
): either a normal completion containing an Iterator Record or a throw completion
- 1. If _obj_ is not an Object, throw a *TypeError* exception.
1. Let _nextMethod_ be ? Get(_obj_, `"next"`).
1. If IsCallable(_nextMethod_) is *false*, throw a *TypeError* exception.
1. Let _iteratorRecord_ be Record { [[Iterator]]: _obj_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
@@ -303,8 +302,10 @@ Iterator.prototype.constructor
Iterator.prototype.map ( _mapper_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. If IsCallable(_mapper_) is *false*, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _mapper_ and performs the following steps when called:
1. Let _counter_ be 0.
1. Repeat,
@@ -324,8 +325,10 @@ Iterator.prototype.map ( _mapper_ )
Iterator.prototype.filter ( _predicate_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _predicate_ and performs the following steps when called:
1. Let _counter_ be 0.
1. Repeat,
@@ -346,11 +349,13 @@ Iterator.prototype.filter ( _predicate_ )
Iterator.prototype.take ( _limit_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. Let _numLimit_ be ? ToNumber(_limit_).
1. If _numLimit_ is *NaN*, throw a *RangeError* exception.
1. Let _integerLimit_ be ! ToIntegerOrInfinity(_numLimit_).
1. If _integerLimit_ < 0, throw a *RangeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _integerLimit_ and performs the following steps when called:
1. Let _remaining_ be _integerLimit_.
1. Repeat,
@@ -370,11 +375,13 @@ Iterator.prototype.take ( _limit_ )
Iterator.prototype.drop ( _limit_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. Let _numLimit_ be ? ToNumber(_limit_).
1. If _numLimit_ is *NaN*, throw a *RangeError* exception.
1. Let _integerLimit_ be ! ToIntegerOrInfinity(_numLimit_).
1. If _integerLimit_ < 0, throw a *RangeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _integerLimit_ and performs the following steps when called:
1. Let _remaining_ be _integerLimit_.
1. Repeat, while _remaining_ > 0,
@@ -395,8 +402,10 @@ Iterator.prototype.drop ( _limit_ )
Iterator.prototype.flatMap ( _mapper_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. If IsCallable(_mapper_) is *false*, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _mapper_ and performs the following steps when called:
1. Let _counter_ be 0.
1. Repeat,
@@ -430,8 +439,10 @@ Iterator.prototype.flatMap ( _mapper_ )
Iterator.prototype.reduce ( _reducer_ [ , _initialValue_ ] )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. If IsCallable(_reducer_) is *false*, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. If _initialValue_ is not present, then
1. Let _next_ be ? IteratorStep(_iterated_).
1. If _next_ is *false*, throw a *TypeError* exception.
@@ -455,7 +466,9 @@ Iterator.prototype.reduce ( _reducer_ [ , _initialValue_ ] )
Iterator.prototype.toArray ( )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _items_ be a new empty List.
1. Repeat,
1. Let _next_ be ? IteratorStep(_iterated_).
@@ -469,8 +482,10 @@ Iterator.prototype.toArray ( )
Iterator.prototype.forEach ( _fn_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. If IsCallable(_fn_) is *false*, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _counter_ be 0.
1. Repeat,
1. Let _next_ be ? IteratorStep(_iterated_).
@@ -486,8 +501,10 @@ Iterator.prototype.forEach ( _fn_ )
Iterator.prototype.some ( _predicate_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _counter_ be 0.
1. Repeat,
1. Let _next_ be ? IteratorStep(_iterated_).
@@ -504,8 +521,10 @@ Iterator.prototype.some ( _predicate_ )
Iterator.prototype.every ( _predicate_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _counter_ be 0.
1. Repeat,
1. Let _next_ be ? IteratorStep(_iterated_).
@@ -522,8 +541,10 @@ Iterator.prototype.every ( _predicate_ )
Iterator.prototype.find ( _predicate_ )
This method performs the following steps when called:
- 1. Let _iterated_ be ? GetIteratorDirect(*this* value).
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, throw a *TypeError* exception.
1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception.
+ 1. Let _iterated_ be ? GetIteratorDirect(_O_).
1. Let _counter_ be 0.
1. Repeat,
1. Let _next_ be ? IteratorStep(_iterated_).