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

Method setdata

jd_try.js:724–743  ·  view source on GitHub ↗
(val, key)

Source from the content-addressed store, hash-verified

722 }
723
724 setdata(val, key) {
725 let issuc = false
726 if (/^@/.test(key)) {
727 const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
728 const objdat = this.getval(objkey)
729 const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}'
730 try {
731 const objedval = JSON.parse(objval)
732 this.lodash_set(objedval, paths, val)
733 issuc = this.setval(JSON.stringify(objedval), objkey)
734 } catch (e) {
735 const objedval = {}
736 this.lodash_set(objedval, paths, val)
737 issuc = this.setval(JSON.stringify(objedval), objkey)
738 }
739 } else {
740 issuc = this.setval(val, key)
741 }
742 return issuc
743 }
744
745 getval(key) {
746 if (this.isSurge() || this.isLoon()) {

Callers 1

setjsonMethod · 0.45

Calls 3

getvalMethod · 0.45
lodash_setMethod · 0.45
setvalMethod · 0.45

Tested by

no test coverage detected