UNPKG

@sanity/client

Version:

Client for retrieving, creating and patching data from Sanity.io

11 lines (8 loc) 287 B
import type {Any} from '../types' export default (obj: Any, defaults: Any) => Object.keys(defaults) .concat(Object.keys(obj)) .reduce((target, prop) => { target[prop] = typeof obj[prop] === 'undefined' ? defaults[prop] : obj[prop] return target }, {} as Any)