Skip to content

Feature: Default when not found #2

@billneff79

Description

@billneff79

I've found us doing this pattern a lot when using dlv:

let foo = dlv(bar, 'a.b.c');
if(typeof foo === 'undefined') foo = defaultFoo;

It might be useful to allow dlv to support a third argument that is a default return value if the key is not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions