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

Commits on Jul 23, 2021

  1. Generalize fromJS() and Seq() to support Sets

    - 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 committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    b068fed View commit details
    Browse the repository at this point in the history