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

Method lodash_set

jd_try.js:695–704  ·  view source on GitHub ↗
(obj, path, value)

Source from the content-addressed store, hash-verified

693 }
694
695 lodash_set(obj, path, value) {
696 if (Object(obj) !== obj) return obj
697 if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
698 path
699 .slice(0, -1)
700 .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
701 path[path.length - 1]
702 ] = value
703 return obj
704 }
705
706 getdata(key) {
707 let val = this.getval(key)

Callers 1

setdataMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected