Patch export function pick(o, ...keys) { return keys.reduce((acc, k) => (Boolean(acc[k]) ? acc[k] : ''), o) } Example Use const items = { a: { b: { c: { total: 100 } } } } pick(items, 'a', 'b', 'c', 'total') // 100