UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

13 lines (9 loc) 249 B
import { curry } from './curry' import { defaultTo } from './defaultTo' function propOrFn( defaultValue, property, obj ){ if (!obj) return defaultValue return defaultTo(defaultValue, obj[ property ]) } export const propOr = curry(propOrFn)