MCPcopy Index your code
hub / github.com/Effect-TS/effect / modify

Method modify

packages/effect/src/internal/hashMap/node.ts:115–149  ·  view source on GitHub ↗
(
    edit: number,
    shift: number,
    f: HashMap.UpdateFn<V>,
    hash: number,
    key: K,
    size: SizeRef
  )

Source from the content-addressed store, hash-verified

113 ) {}
114
115 modify(
116 edit: number,
117 shift: number,
118 f: HashMap.UpdateFn<V>,
119 hash: number,
120 key: K,
121 size: SizeRef
122 ): Node<K, V> {
123 if (hash === this.hash) {
124 const canEdit = canEditNode(this, edit)
125 const list = this.updateCollisionList(
126 canEdit,
127 edit,
128 this.hash,
129 this.children,
130 f,
131 key,
132 size
133 )
134 if (list === this.children) return this
135
136 return list.length > 1 ? new CollisionNode(edit, this.hash, list) : list[0]! // collapse single element collision list
137 }
138 const v = f(O.none())
139 if (O.isNone(v)) return this
140 ++size.value
141 return mergeLeaves(
142 edit,
143 shift,
144 this.hash,
145 this,
146 hash,
147 new LeafNode(edit, hash, key, v)
148 )
149 }
150
151 updateCollisionList(
152 mutate: boolean,

Callers

nothing calls this directly

Calls 4

updateCollisionListMethod · 0.95
canEditNodeFunction · 0.85
mergeLeavesFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected