rtfeldman/seamless-immutable

Doesn't play well with Symbols (generators?)

开放

#107 创建于 2016年3月1日

 (2 条评论) (0 个反应) (0 位负责人)JavaScript (221 个派生)batch import
bughelp wanted

仓库指标

星标
 (5,367 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南