rtfeldman/seamless-immutable

Doesn't play well with Symbols (generators?)

Open

#107 geöffnet am 1. März 2016

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (221 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (5.367 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Great library. I have a pretty esoteric case, but the failure seems to be real.

This code:

let context = {
    * [Symbol.iterator]() {
        yield Promise.resolve(1);
        yield Promise.resolve(2);
    }
};

for (let P of context) {
    console.log(P.value());
}

// 1
// 2

Fails if wrapped by Immutable:

let context = Immutable({
    * [Symbol.iterator]() {
        yield Promise.resolve(1);
        yield Promise.resolve(2);
    }
});

...

for (let P of context) {
              ^
TypeError: undefined is not a function

I'm not sure if it is the generator or the symbol usage (or computed property keys or the compact object method signature) that's causing the problem.

Running on Node (5.x), with --harmony flag. Also, bluebird is the Promise implementation.

Contributor Guide