UNPKG

rambdax

Version:

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

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