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

Method setdata

Env.js:271–294  ·  view source on GitHub ↗
(val, key)

Source from the content-addressed store, hash-verified

269 }
270
271 setdata(val, key) {
272 let issuc = false
273 if (/^@/.test(key)) {
274 const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
275 const objdat = this.getval(objkey)
276 const objval = objkey
277 ? objdat === 'null'
278 ? null
279 : objdat || '{}'
280 : '{}'
281 try {
282 const objedval = JSON.parse(objval)
283 this.lodash_set(objedval, paths, val)
284 issuc = this.setval(JSON.stringify(objedval), objkey)
285 } catch (e) {
286 const objedval = {}
287 this.lodash_set(objedval, paths, val)
288 issuc = this.setval(JSON.stringify(objedval), objkey)
289 }
290 } else {
291 issuc = this.setval(val, key)
292 }
293 return issuc
294 }
295
296 getval(key) {
297 switch (this.getEnv()) {

Callers 15

setjsonMethod · 0.45
getcookieFunction · 0.45
GetCookieFunction · 0.45
videoqq.cookie.jsFile · 0.45
mgtv.cookie.jsFile · 0.45
qmkg.cookie.jsFile · 0.45
mihoyo.cookie.jsFile · 0.45
yanxuan.cookie.jsFile · 0.45
maomicd.cookie.jsFile · 0.45
qqmusic.cookie.jsFile · 0.45

Calls 3

getvalMethod · 0.45
lodash_setMethod · 0.45
setvalMethod · 0.45

Tested by

no test coverage detected