Skip to content

Better handling of default values #139

@droguljic

Description

@droguljic

Currently, defaults are merged with provided arguments using following approach

const argsWithDefaults = Object.assign({}, defaults, args);

This works well when the argument is not provided, as the default value will end in the resulting object. However, providing argument with the undefined value removes default from the resulting object.

The described behavior is not intended, and the default value should end up in the resulting object in both cases.

To fix this behavior, a helper must be implemented to ensure defaults are ending in the resulting object when argument is omitted or its value is set to undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions