MCPcopy
hub / github.com/vuejs/devtools-v6 / set

Method set

packages/shared-utils/src/edit.ts:4–22  ·  view source on GitHub ↗
(object, path, value, cb = null)

Source from the content-addressed store, hash-verified

2
3export class StateEditor {
4 set(object, path, value, cb = null) {
5 const sections = Array.isArray(path) ? path : path.split('.')
6 while (sections.length > 1) {
7 object = object[sections.shift()]
8 if (this.isRef(object)) {
9 object = this.getRefValue(object)
10 }
11 }
12 const field = sections[0]
13 if (cb) {
14 cb(object, field, value)
15 }
16 else if (this.isRef(object[field])) {
17 this.setRefValue(object[field], value)
18 }
19 else {
20 object[field] = value
21 }
22 }
23
24 get(object, path) {
25 const sections = Array.isArray(path) ? path : path.split('.')

Callers 15

index.jsFile · 0.80
connectFunction · 0.80
emitFunction · 0.80
cleanupBufferFunction · 0.80
handleCopyFunction · 0.80
performanceMarkStartFunction · 0.80
performanceMarkEndFunction · 0.80
getFunction · 0.80
createAppRecordFunction · 0.80
getAppRecordFunction · 0.80
getBackendFunction · 0.80
addTimelineEventFunction · 0.80

Calls 4

isRefMethod · 0.95
getRefValueMethod · 0.95
setRefValueMethod · 0.95
shiftMethod · 0.80

Tested by

no test coverage detected