MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / spliceAfter

Function spliceAfter

ses.cjs:1206–1223  ·  view source on GitHub ↗
(prev, selfCell)

Source from the content-addressed store, hash-verified

1204 * @param {DoublyLinkedCell<Data>} selfCell
1205 */
1206const spliceAfter= (prev, selfCell)=> {
1207 if( prev=== selfCell) {
1208 throw TypeError('Cannot splice a cell into itself');
1209 }
1210 if( selfCell.next!== selfCell|| selfCell.prev!== selfCell) {
1211 throw TypeError('Expected self-linked cell');
1212 }
1213 const cell= selfCell;
1214 // rename variable cause it isn't self-linked after this point.
1215
1216 const next= prev.next;
1217 cell.prev= prev;
1218 cell.next= next;
1219 prev.next= cell;
1220 next.prev= cell;
1221 // Not frozen!
1222 return cell;
1223 };
1224
1225/**
1226 * @template Data

Callers 2

touchCellFunction · 0.85
setFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected