You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for the great library. I added a custom function with complex params. when the function is applied, it throws an error 'throw new Error("Unrecognized operation " + op );'
Example below:
var a = {val: 1};
var b = {val: 2};
//this works
var plus = function(a,b){ return a+b; };
jsonLogic.add_operation("plus", plus);
jsonLogic.apply({"plus":[a.val, b.val ]});
//THIS THROWS ERROR
var objectPlus = function(a,b){ return a.val+b.val; };
jsonLogic.add_operation("objectPlus", objectPlus);
jsonLogic.apply({"objectPlus":[a, b]});
I will also add that a complex single param works.
//this works too
var operands = {a : {val: 1},b : {val: 2}} ;
var objectPlusSingleParam = function(op){ return op.a.val + op.b.val; };
jsonLogic.add_operation("objectPlusSingleParam", objectPlusSingleParam);
jsonLogic.apply({"objectPlusSingleParam": [operands] });
The text was updated successfully, but these errors were encountered:
Hello,
Thank you for the great library. I added a custom function with complex params. when the function is applied, it throws an error 'throw new Error("Unrecognized operation " + op );'
Example below:
I will also add that a complex single param works.
The text was updated successfully, but these errors were encountered: