rtfeldman/seamless-immutable

`merge` ignores Symbols contrary to `set`

Open

#189 建立於 2016年12月28日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)JavaScript (5,367 star) (221 fork)batch import
bughelp wanted

描述

Using Immutable 7.0.1, Babel, and Node 6, it seems that merge skips properties where the key is a Symbol, while set (correctly) sets them. It works with normal objects. Example:

babel> const Immutable =  require('seamless-immutable');
babel> const s = Symbol("sym mine");
babel> Immutable({}).merge({[s]: "sym val"})[s]
undefined // WRONG: expected 'sym val'
babel> Immutable({}).set(s, "sym val")[s]
'sym val' // CORRECT

However it works when the key is not a Symbol but a normal object:

> var Immutable =  require('seamless-immutable');
> var s = {name: "key obj"};
> Immutable({}).merge({[s]: "sym val"})[s]
'sym val'

貢獻者指南

`merge` ignores Symbols contrary to `set` · rtfeldman/seamless-immutable#189 | Good First Issue