Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

events: use Infinity for setMaxListeners instead of 0 #22987

Closed
@jasonkarns

Description

@jasonkarns

Is there a sound reason for choosing 0 as the magic value that disables the max listeners? It's essentially using 0 as a special value to represent unlimited but JS already has a perfectly valid number to represent infinity: Infinity. It would simplify the memory-leak checking as the 0 special case would no longer need checked. Any number would naturally return true for n < Infinity.

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