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

Generalize fromJS() and Seq() to support Sets #1865

Merged
merged 1 commit into from Jul 23, 2021
Merged

Generalize fromJS() and Seq() to support Sets #1865

merged 1 commit into from Jul 23, 2021

Conversation

leebyron
Copy link
Collaborator

@leebyron leebyron commented Jul 23, 2021

  • When calling Seq(value) on an iterable value, use the convention of the default iterator method being equal to one of the prototype methods value.entries() and value.keys() as a clear indication of Keyed or Set style collections.
    • Introduces isEntriesIterable() and isKeysIterable() to capture these patterns.
    • Uses them within Seq() to produce an entries sequence or set sequence.
  • Use the general Seq() in the implementation of fromJS(), rather than repeating the logic of determining which Seq conversion to apply.
    • Replaces this logic with constraints on which values can be converted
    • Introduces allowing iterable objects
    • Introduces allowing array-likes
  • Add toSet() as a possible return from the default converter of fromJS() in the case the generated Seq is a SetSeq.

Fixes #1723

- When calling `Seq(value)` on an iterable value, use the convention of the default iterator method being equal to one of the prototype methods `value.entries()` and `value.keys()` as a clear indication of Keyed or Set style collections.
  - Introduces `isEntriesIterable()` and `isKeysIterable()` to capture these patterns.
  - Uses them within `Seq()` to produce an entries sequence or set sequence.
- Use the general `Seq()` in the implementation of `fromJS()`, rather than repeating the logic of determining which Seq conversion to apply.
  - Replaces this logic with constraints on which values can be converted
  - Introduces allowing iterable objects
  - Introduces allowing array-likes
- Add `toSet()` as a possible return from the default converter of `fromJS()` in the case the generated Seq is a SetSeq.
@leebyron leebyron merged commit 7c64271 into main Jul 23, 2021
@leebyron leebyron deleted the seq-to-js branch July 23, 2021 16:49
@amr-labib
Copy link

Hi, when do you expect to release this change?

Thanks
Labib

@jdeniau
Copy link
Member

jdeniau commented Aug 18, 2021

Hi @amr-labib. There will probably be a release in september.

@jdeniau
Copy link
Member

jdeniau commented Sep 16, 2021

@amr-labib the v4.0.0-rc.15 has been released !

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

Successfully merging this pull request may close these issues.

Map and Set are not converted to Immutable.Map and Immutable.Set via Immutable.fromJS()
3 participants