Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Introduce .from static method, deprecate #toAnyCollection methods #1358

Closed
@avocadowastaken

Description

@avocadowastaken

I like the way Array.from works. It takes any iterable and casts it to array.

As discussed in #317 - we have to deprecate toMap, toList, and etc. methods, but we also need a good replacement for it.

We can do this in constructors - but immutable class constructors returns values in it, which is restricted in es6 classes spec and sooner or later people will start to demand untranspiled ES6 module version for modern browsers.

And as a summary:

  1. Implement #from(iterable) for each method.
  2. Add deprecation warnings for toCollection methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions