Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot perform diff on a Map with non string keys #13

Open
kbrownlees opened this issue Feb 8, 2017 · 2 comments
Open

Cannot perform diff on a Map with non string keys #13

kbrownlees opened this issue Feb 8, 2017 · 2 comments

Comments

@kbrownlees
Copy link

> a = i.Map().set(null, 1)
> b = i.Map().set(null, 2)
> id(a, b)
param str (null) is not a string

The error comes from https://github.com/intelie/immutable-js-diff/blob/master/src/path.js#L14 where it is trying to determine the path of the key (https://github.com/intelie/immutable-js-diff/blob/master/src/diff.js#L56).

@tiye
Copy link

tiye commented Feb 8, 2017

Somehow it appears to me that we should avoid using null as a key...

@pedroteixeira
Copy link
Contributor

You're probably right. This type of key doesn't seem to be supported, mainly because the implementation was based on the JSON Patch https://tools.ietf.org/html/rfc6902, where all object keys are string.

Not sure what's the best way to go in representing non-string keys for the patch. Perhaps a escaped symbol to represent?

Feel free to submit Pull Requests or ideas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants