[utils] .get is trying to get value inside the default value
dackmin opened this issue · 1 comments
dackmin commented
junipero/packages/junipero-utils/lib/core/index.js
Lines 65 to 67 in 968bead
get({}, 'foo.bold', 'Default value');
dackmin commented
fix:
export const get = (obj = {}, path = '', defaultValue = null) => path
.split('.')
.reduce((a, c) => exists(a?.[c]) ? a[c] : undefined, obj) ?? defaultValue;