Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
fixes #169: throw a RangeError in take/drop when input is NaN-ish
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed Jul 5, 2022
1 parent 33e8b2c commit 5a99786
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,9 @@ <h1>%Iterator.prototype%.filter ( _filterer_ )</h1>
<h1>%Iterator.prototype%.take ( _limit_ )</h1>
<emu-alg>
1. Let _iterated_ be ? GetIteratorDirect(*this* value).
1. Let _integerLimit_ be ? ToIntegerOrInfinity(_limit_).
1. Let _numLimit_ be ? ToNumber(_limit_).
1. If _numLimit_ is *NaN*, throw a *RangeError* exception.
1. Let _integerLimit_ be ! ToIntegerOrInfinity(_numLimit_).
1. If _integerLimit_ &lt; 0, throw a *RangeError* exception.
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_.
Expand All @@ -555,7 +557,9 @@ <h1>%Iterator.prototype%.take ( _limit_ )</h1>
<h1>%Iterator.prototype%.drop ( _limit_ )</h1>
<emu-alg>
1. Let _iterated_ be ? GetIteratorDirect(*this* value).
1. Let _integerLimit_ be ? ToIntegerOrInfinity(_limit_).
1. Let _numLimit_ be ? ToNumber(_limit_).
1. If _numLimit_ is *NaN*, throw a *RangeError* exception.
1. Let _integerLimit_ be ! ToIntegerOrInfinity(_numLimit_).
1. If _integerLimit_ &lt; 0, throw a *RangeError* exception.
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_.
Expand Down

0 comments on commit 5a99786

Please sign in to comment.