Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 'some', 'all', 'none' operators #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check that the logic object....has logic.
internalfx committed Mar 16, 2017
commit 4300b578b5b9ed5d602451d1f2678c67fbd0534e
6 changes: 5 additions & 1 deletion logic.js
Original file line number Diff line number Diff line change
@@ -201,6 +201,11 @@ http://ricostacruz.com/cheatsheets/umdjs.html

data = data || {};

// If logic is empty object, return true.
if (Object.keys(logic).length === 0) {
return true
}

var op = Object.keys(logic)[0];
var values = logic[op];
var i;
@@ -278,7 +283,6 @@ http://ricostacruz.com/cheatsheets/umdjs.html
return jsonLogic.apply(val, data);
});


if(typeof operations[op] === "function") {
return operations[op].apply(data, values);
}else if(op.indexOf(".") > 0) { // Contains a dot, and not in the 0th position