joelnet / MojiScript

MojiScript is an async-first, opinionated, and functional library

Home Page:https://mojiscript.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create object/pathOr

joelnet opened this issue · comments

Need to create a function to deep select an object or provide a default value.

Expected

const customer1 = {
  address: {
    state: 'CA'
  }
}

const customer2 = { }

pathOr ('--') ([ 'address', 'state' ]) (customer1) //=> 'CA'
pathOr ('--') ([ 'address', 'state' ]) (customer2) //=> '--'

Acceptance Criteria

  • object/pathOr.js is created
  • unit tests are created.

Working on this! Happy Hacktoberfest 🎃

edit here is the PR #244

excellent work! this has been merged into develop.