Skip to content

undefined handling for pin specifier  #42

@phoddie

Description

@phoddie

Pin Specifiers are passed to IO constructors:

new Digital({pin: 1, mode: Digital.Input});

During development of ECMA-419 2nd Edition, it was observed that when the pin is undefined -- often because the user accidentally left out the pin property -- that pin 0 was used. This is because undefined becomes 0 when coerced to a number. Using pin 0 is entirely unexpected.

The Moddable SDK implementation of ECMA-419 IO was updated to throw on a value of undefined for a pin specifier. This is not currently reflected in the specification. I think we should update this for 3rd Edition.

There are likely other cases where undefined should be rejected as a value, such as Port Specifiers and mode.

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