MCPcopy Index your code
hub / github.com/TanStack/db / insertInLeaf

Method insertInLeaf

packages/db/src/utils/btree.ts:578–590  ·  view source on GitHub ↗
(i: index, key: K, value: V, tree: BTree<K, V>)

Source from the content-addressed store, hash-verified

576 }
577
578 insertInLeaf(i: index, key: K, value: V, tree: BTree<K, V>) {
579 this.keys.splice(i, 0, key)
580 if (this.values === undefVals) {
581 while (undefVals.length < tree._maxNodeSize) undefVals.push(undefined)
582 if (value === undefined) {
583 return true
584 } else {
585 this.values = undefVals.slice(0, this.keys.length - 1)
586 }
587 }
588 this.values.splice(i, 0, value)
589 return true
590 }
591
592 takeFromRight(rhs: BNode<K, V>) {
593 // Reminder: parent node must update its copy of key for this node

Callers 1

setMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected