Skip to content

Inclusion of numeric argument in receiver instance creation? #22

Closed
@senocular

Description

@senocular

From readme Generic factory method:

fromAsync can be transferred to or inherited by any other constructor with a single numeric parameter. In that case, the final result will be the data structure created by that constructor (with 0 as its argument)...

While species and of() create arrays with a numeric argument, presumably since they'd be able to have knowledge of predetermined length, shouldn't fromAsync() be consistent with from() since the length of the iterable would/could be unknown?

class Custom extends Array {
    constructor (length) {
        super()
        console.log('Argument length:', length)
    }
}
Custom.from([1,2,3]) // Argument length: undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions