MCPcopy
hub / github.com/chavyleung/scripts / lodash_get

Method lodash_get

Env.js:226–236  ·  view source on GitHub ↗
(source, path, defaultValue = undefined)

Source from the content-addressed store, hash-verified

224 }
225
226 lodash_get(source, path, defaultValue = undefined) {
227 const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.')
228 let result = source
229 for (const p of paths) {
230 result = Object(result)[p]
231 if (result === undefined) {
232 return defaultValue
233 }
234 }
235 return result
236 }
237
238 lodash_set(obj, path, value) {
239 if (Object(obj) !== obj) return obj

Callers 1

getdataMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected