MCPcopy Index your code
hub / github.com/mobxjs/mobx / set

Method set

packages/mobx/src/types/observablemap.ts:146–166  ·  view source on GitHub ↗
(key: K, value: V)

Source from the content-addressed store, hash-verified

144 }
145
146 set(key: K, value: V) {
147 const hasKey = this.has_(key)
148 if (hasInterceptors(this)) {
149 const change = interceptChange<IMapWillChange<K, V>>(this, {
150 type: hasKey ? UPDATE : ADD,
151 object: this,
152 newValue: value,
153 name: key
154 })
155 if (!change) {
156 return this
157 }
158 value = change.newValue!
159 }
160 if (hasKey) {
161 this.updateValue_(key, value)
162 } else {
163 this.addValue_(key, value)
164 }
165 return this
166 }
167
168 delete(key: K): boolean {
169 checkIfStateModificationsAreAllowed(this.keysAtom_)

Callers 2

mergeMethod · 0.95
replaceMethod · 0.95

Calls 5

has_Method · 0.95
updateValue_Method · 0.95
addValue_Method · 0.95
hasInterceptorsFunction · 0.85
interceptChangeFunction · 0.85

Tested by

no test coverage detected