Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 50ed6aa

Browse files
Fix yield * of falsy values (#711)
1 parent 7c16d9b commit 50ed6aa

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/runtime/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ var runtime = (function (exports) {
487487
};
488488

489489
function values(iterable) {
490-
if (iterable || iterable === "") {
490+
if (iterable != null) {
491491
var iteratorMethod = iterable[iteratorSymbol];
492492
if (iteratorMethod) {
493493
return iteratorMethod.call(iterable);

test/tests.es6.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,17 @@ describe("delegated yield", function() {
15371537
it.next();
15381538
}, TypeError);
15391539
});
1540+
1541+
it("should work with falsy values", function () {
1542+
try {
1543+
Boolean.prototype[Symbol.iterator] = function* () { yield "Hello" };
1544+
function* gen() { yield* false; };
1545+
1546+
check(gen(), ["Hello"]);
1547+
} finally {
1548+
delete Boolean.prototype[Symbol.iterator];
1549+
}
1550+
});
15401551
});
15411552

15421553
(fullCompatibility

0 commit comments

Comments
 (0)