USStateDept / State-TalentMAP

A comprehensive research, bidding, and matching system to match Foreign Service employees with the right skills to available posts and positions. API Layer - https://github.com/USStateDept/State-TalentMAP-API
Other
31 stars 16 forks source link

Incorporate library for nested traversal #1345

Closed mjoyce91 closed 6 years ago

mjoyce91 commented 6 years ago

Look into https://www.npmjs.com/package/dot-prop and use instead of conditionally checking for nested properties.

jseppi commented 6 years ago

@afrasier wrote himself a similar helper for the api code: https://github.com/18F/State-TalentMAP-API/blob/dev/talentmap_api/common/common_helpers.py#L32

jseppi commented 6 years ago

also it might be nice to encapsulate some default value behavior into a wrapping method:


function propOrDefault(obj, path, default = null) {
  return dotProp.get(obj, path) || default;
}

//...

// in a component somewhere...
const ccc = propOrDefault(position, 'aaa.bbb.ccc', NO_CCC);