MCPcopy Create free account
hub / github.com/Semporia/Scripts / lodash_get

Method lodash_get

jd_api_test.js:237–242  ·  view source on GitHub ↗
(t, e, s)

Source from the content-addressed store, hash-verified

235 }
236
237 lodash_get(t, e, s) {
238 const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
239 let r = t;
240 for (const t of i) if (r = Object(r)[t], void 0 === r) return s;
241 return r
242 }
243
244 lodash_set(t, e, s) {
245 return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)

Callers 1

getdataMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected