MCPcopy Index your code
hub / github.com/chavyleung/scripts / apiUpdate

Function apiUpdate

chavy.box.js:738–756  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

736}
737
738async function apiUpdate() {
739 const data = $.toObj($request.body)
740 const path = data.path.split('.')
741 const val = data.val
742 const key = path.shift()
743 // 必须用 hasOwnProperty:val 为 false 时 data.val && … 会误判为跳过更新
744 if (path.join('.') && Object.prototype.hasOwnProperty.call(data, 'val')) {
745 switch (key) {
746 case 'usercfgs':
747 const usercfgs = getUserCfgs()
748 update(usercfgs, path.join('.'), val)
749 $.setjson(usercfgs, $.KEY_usercfgs)
750 break
751 default:
752 break
753 }
754 }
755 $.json = getBoxData()
756}
757
758async function apiAddAppSub() {
759 const sub = $.toObj($request.body)

Callers

nothing calls this directly

Calls 5

getUserCfgsFunction · 0.70
updateFunction · 0.70
getBoxDataFunction · 0.70
toObjMethod · 0.45
setjsonMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…