MCPcopy Create free account
hub / github.com/FernhillFable/cluster / transform

Function transform

test/client/deserialized-type.js:93–108  ·  view source on GitHub ↗
(op1, op2, side)

Source from the content-addressed store, hash-verified

91}
92
93function transform(op1, op2, side) {
94 if (
95 typeof op1.insert === 'number' &&
96 typeof op2.insert === 'number'
97 ) {
98 var index = op1.insert;
99 if (op2.insert < index || (op2.insert === index && side === 'left')) {
100 index++;
101 }
102 return {
103 insert: index,
104 value: op1.value
105 };
106 }
107 throw new Error('Op not recognized');
108}
109
110// A custom linked list object type to demonstrate custom deserialization
111function Node(value, next) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected