(op1, op2, side)
| 91 | } |
| 92 | |
| 93 | function 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 |
| 111 | function Node(value, next) { |
nothing calls this directly
no outgoing calls
no test coverage detected