Skip to content

Throw if toSkip > Number.MAX_SAFE_INTEGER #12

@kmiller68

Description

@kmiller68

Right now this happily accepts toSkip values bigger than Number.MAX_SAFE_INTEGER however that means implementing this in JS faithfully requires using a BigInt, which is sub-optimal for performance. I think anyone passing a value bigger than Number.MAX_SAFE_INTEGER is likely making a mistake anyway. It would take ~4 months to drive an iterator past Number.MAX_SAFE_INTEGER elements assuming each next took 1ns, which seems optimistic.

Presumably the correct error is a RangeError but I wouldn't necessarily block on a different one.

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