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

Method modify

packages/effect/src/internal/hashMap/node.ts:70–102  ·  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

68 ) {}
69
70 modify(
71 edit: number,
72 shift: number,
73 f: HashMap.UpdateFn<V>,
74 hash: number,
75 key: K,
76 size: SizeRef
77 ): Node<K, V> {
78 if (equals(key, this.key)) {
79 const v = f(this.value)
80 if (v === this.value) return this
81 else if (O.isNone(v)) {
82 --size.value
83 return new EmptyNode()
84 }
85 if (canEditNode(this, edit)) {
86 this.value = v
87 return this
88 }
89 return new LeafNode(edit, hash, key, v)
90 }
91 const v = f(O.none())
92 if (O.isNone(v)) return this
93 ++size.value
94 return mergeLeaves(
95 edit,
96 shift,
97 this.hash,
98 this,
99 hash,
100 new LeafNode(edit, hash, key, v)
101 )
102 }
103}
104
105/** @internal */

Callers

nothing calls this directly

Calls 4

canEditNodeFunction · 0.85
mergeLeavesFunction · 0.85
equalsFunction · 0.50
fFunction · 0.50

Tested by

no test coverage detected