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

Commit 5f87ebe

Browse files
Merge branch 'main' into transcend
2 parents 2a76ee5 + 257f4ea commit 5f87ebe

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,9 @@ function* naturals() {
296296
naturals().find(v => v > 1); // 2
297297
```
298298

299-
### `.from(object)`
299+
### `Iterator.from(object)`
300300

301-
`.from` takes an object as an argument. This method allows wrapping "iterator-like" objects with an
302-
iterator.
301+
`.from` is a _static_ method (unlike the others listed above) which takes an object as an argument. This method allows wrapping "iterator-like" objects with an iterator.
303302

304303
Returns the object if it is already an iterator, returns a wrapping iterator if the passed object
305304
implements a callable @@iterator property.

spec.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ <h1>
129129
<h1>
130130
GetIteratorFlattenable (
131131
_obj_: an ECMAScript language value,
132+
_stringHandling_: ~iterate-strings~ or ~reject-strings~,
132133
): either a normal completion containing an Iterator Record or a throw completion
133134
</h1>
134135
<dl class="header">
135136
</dl>
136137
<emu-alg>
137-
1. If _obj_ is not an Object, throw a *TypeError* exception.
138+
1. If _obj_ is not an Object, then
139+
1. If _stringHandling_ is ~reject-strings~ or _obj_ is not a String, throw a *TypeError* exception.
138140
1. Let _method_ be ? GetMethod(_obj_, @@iterator).
139141
1. If _method_ is *undefined*, then
140142
1. Let _iterator_ be _obj_.
@@ -187,8 +189,7 @@ <h1>Iterator.prototype</h1>
187189
<emu-clause id="sec-iterator.from">
188190
<h1>Iterator.from ( _O_ )</h1>
189191
<emu-alg>
190-
1. If _O_ is a String, set _O_ to ! ToObject(_O_).
191-
1. Let _iteratorRecord_ be ? GetIteratorFlattenable(_O_).
192+
1. Let _iteratorRecord_ be ? GetIteratorFlattenable(_O_, ~iterate-strings~).
192193
1. Let _hasInstance_ be ? OrdinaryHasInstance(%Iterator%, _iteratorRecord_.[[Iterator]]).
193194
1. If _hasInstance_ is *true*, then
194195
1. Return _iteratorRecord_.[[Iterator]].
@@ -443,7 +444,7 @@ <h1>Iterator.prototype.flatMap ( _mapper_ )</h1>
443444
1. Let _value_ be ? IteratorValue(_next_).
444445
1. Let _mapped_ be Completion(Call(_mapper_, *undefined*, « _value_, 𝔽(_counter_) »)).
445446
1. IfAbruptCloseIterator(_mapped_, _iterated_).
446-
1. Let _innerIterator_ be Completion(GetIteratorFlattenable(_mapped_)).
447+
1. Let _innerIterator_ be Completion(GetIteratorFlattenable(_mapped_, ~reject-strings~)).
447448
1. IfAbruptCloseIterator(_innerIterator_, _iterated_).
448449
1. Let _innerAlive_ be *true*.
449450
1. Repeat, while _innerAlive_ is *true*,

0 commit comments

Comments
 (0)