|
|
@ -6,6 +6,11 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var validate = JsonOT.validate = function (text, toTransform, transformBy) {
|
|
|
|
var validate = JsonOT.validate = function (text, toTransform, transformBy) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
// text = O (mutual common ancestor)
|
|
|
|
|
|
|
|
// toTransform = A (the first incoming operation)
|
|
|
|
|
|
|
|
// transformBy = B (the second incoming operation)
|
|
|
|
|
|
|
|
// threeway merge (0, A, B)
|
|
|
|
|
|
|
|
|
|
|
|
var resultOp = ChainPad.Operation.transform0(text, toTransform, transformBy);
|
|
|
|
var resultOp = ChainPad.Operation.transform0(text, toTransform, transformBy);
|
|
|
|
var text2 = ChainPad.Operation.apply(transformBy, text);
|
|
|
|
var text2 = ChainPad.Operation.apply(transformBy, text);
|
|
|
|
var text3 = ChainPad.Operation.apply(resultOp, text2);
|
|
|
|
var text3 = ChainPad.Operation.apply(resultOp, text2);
|
|
|
|