A bug in base.compose()?
MiroHibler opened this issue · 1 comments
MiroHibler commented
Hi Joshua,
Great work!
While building my application around it, I discovered a bug in base.compose() method.
I ran this test:
var assert = require('assert')
var base = require("../jot/jot/base.js");
var e = [
{
"module_name": "sequences.js",
"type": "apply",
"pos":0,
"op": {
"module_name": "objects.js",
"type": "apply",
"key": "element",
"op": {
"module_name": "objects.js",
"type": "apply",
"key": "attrs",
"op": {
"module_name": "objects.js",
"type": "apply",
"key": "fill",
"op": {
"module_name": "sequences.js",
"type": "splice",
"pos":1,
"old_value": "FFF", // <--
"new_value": "1", // <--
"global_order":null
}
}
}
}
},
{
"module_name": "sequences.js",
"type": "apply",
"pos":0,
"op": {
"module_name": "objects.js",
"type": "apply",
"key": "element",
"op": {
"module_name": "objects.js",
"type": "apply",
"key": "attrs",
"op": {
"module_name": "objects.js",
"type": "apply",
"key": "fill",
"op": {
"module_name": "sequences.js",
"type": "splice",
"pos":2,
"old_value": "", // <--
"new_value": "2", // <--
"global_order":null
}
}
}
}
}
];
// assert.deepEqual(
// base.compose( e[0], e[1] ),
// {
// "module_name": "sequences.js",
// "type": "apply",
// "pos":0,
// "op": {
// "module_name": "objects.js",
// "type": "apply",
// "key": "element",
// "op": {
// "module_name": "objects.js",
// "type": "apply",
// "key": "attrs",
// "op": {
// "module_name": "objects.js",
// "type": "apply",
// "key": "fill",
// "op": {
// "module_name": "sequences.js",
// "type": "splice",
// "pos":1,
// "old_value": "", // <--
// "new_value": "12", // <--
// "global_order":null
// }
// }
// }
// }
// }
// );
// Assert throws error, so:
console.log( base.compose( e[0], e[1] ) );
which returns:
{
module_name: 'sequences.js',
type: 'apply',
pos: 0,
op: 'objects.js'
}
Thanks!
Miro
JoshData commented
Thanks for reporting the problem! Should be fixed now.