Open ghost opened 5 years ago
@lightnguyen not sure, but I added this test case and it seems to work as expected?
it("filters out things as expected when returning empty array", function() {
var array = Immutable(["drop the numbers!", 3, 2, 1, 0, null, undefined]);
var expected = Immutable(["drop the numbers!", null, undefined]);
var actual = Immutable.flatMap(array, function(value) {
if (typeof value === "number") {
return [];
} else {
return value;
}
});
TestUtils.assertJsonEqual(actual, expected);
});
Looks like you expecte immutable variable 'array' is ["drop the numbers!", 3, 2, 1, 0, null, undefined]
. This is not right. You need a another variable to take the return of Immutable.flatMap
I tried this example in the docs and the returned array isn't changed at all
I'm using seamless-immutable v7.1.4. Is this a bug or am I doing anything wrong?