UNPKG

rambda

Version:

Lightweight and faster alternative to Ramda with included TS definitions

12 lines (9 loc) 216 B
import { defaultTo } from './defaultTo.js' export function propOr(property, defaultValue) { return obj => { if (!obj) { return defaultValue } return defaultTo(defaultValue)(obj[property]) } }