Skip to content

Feature: Default when not found #2

Closed

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

Activity

  1. developit commented on Jan 28, 2017

    @developit
    Owner

    Sounds like a nice addition.

  2. developit commented on Jan 31, 2017

    @developit
    Owner

    Fix merged and released as 1.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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