|
|
@ -5,19 +5,23 @@ define([
|
|
|
|
var JsonOT = {};
|
|
|
|
var JsonOT = {};
|
|
|
|
|
|
|
|
|
|
|
|
var validate = JsonOT.validate = function (text, toTransform, transformBy) {
|
|
|
|
var validate = JsonOT.validate = function (text, toTransform, transformBy) {
|
|
|
|
var resultOp = ChainPad.Operation.transform0(text, toTransform, transformBy);
|
|
|
|
|
|
|
|
var text2 = ChainPad.Operation.apply(transformBy, text);
|
|
|
|
|
|
|
|
var text3 = ChainPad.Operation.apply(resultOp, text2);
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
JSON.parse(text3);
|
|
|
|
var resultOp = ChainPad.Operation.transform0(text, toTransform, transformBy);
|
|
|
|
return resultOp;
|
|
|
|
var text2 = ChainPad.Operation.apply(transformBy, text);
|
|
|
|
} catch (e) {
|
|
|
|
var text3 = ChainPad.Operation.apply(resultOp, text2);
|
|
|
|
console.error(e);
|
|
|
|
try {
|
|
|
|
console.log({
|
|
|
|
JSON.parse(text3);
|
|
|
|
resultOp: resultOp,
|
|
|
|
return resultOp;
|
|
|
|
text2: text2,
|
|
|
|
} catch (e) {
|
|
|
|
text3: text3
|
|
|
|
console.error(e);
|
|
|
|
});
|
|
|
|
console.log({
|
|
|
|
|
|
|
|
resultOp: resultOp,
|
|
|
|
|
|
|
|
text2: text2,
|
|
|
|
|
|
|
|
text3: text3
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (x) {
|
|
|
|
|
|
|
|
console.error(x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// returning **null** breaks out of the loop
|
|
|
|
// returning **null** breaks out of the loop
|
|
|
|