Comparing version 0.1.0 to 0.2.0
@@ -29,3 +29,3 @@ /* | ||
mod_jsprim.forEachKey(types, function (k, v) { | ||
if (v !== 'string' && v !== 'number') | ||
if (v !== 'string' && v !== 'number' && v !== 'boolean') | ||
throw (new VError( | ||
@@ -230,5 +230,7 @@ 'field "%s": unknown type "%s"', k, v)); | ||
'eq': new RelationalOperator( | ||
'==', [ 'number', 'string' ], function (a, b) { return (a == b); }), | ||
'==', [ 'number', 'string', 'boolean' ], | ||
function (a, b) { return (a == b); }), | ||
'ne': new RelationalOperator( | ||
'!=', [ 'number', 'string' ], function (a, b) { return (a != b); }), | ||
'!=', [ 'number', 'string', 'boolean' ], | ||
function (a, b) { return (a != b); }), | ||
'and': new LogicalOperator('&&'), | ||
@@ -381,5 +383,7 @@ 'or': new LogicalOperator('||') | ||
if (typeof (constant) != 'number' && typeof (constant) != 'string') | ||
throw (new VError('predicate %j: field "%s" is not a string ' + | ||
'or number')); | ||
if (typeof (constant) != 'number' && | ||
typeof (constant) != 'string' && | ||
typeof (constant) != 'boolean') | ||
throw (new VError('predicate %j: field "%s" is not a string, ' + | ||
'number, or boolean', pred, key)); | ||
} | ||
@@ -386,0 +390,0 @@ |
{ | ||
"name": "krill", | ||
"description": "simple boolean filter language", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -37,2 +37,18 @@ /* | ||
}, { | ||
pred: { eq: ['audit', true] }, /* eq: booleans, == */ | ||
values: { 'audit': true }, | ||
result: true | ||
}, { | ||
pred: { eq: ['audit', false] }, /* eq: booleans, == */ | ||
values: { 'audit': true }, | ||
result: false | ||
}, { | ||
pred: { eq: ['audit', true] }, /* eq: booleans, != */ | ||
values: { 'audit': false }, | ||
result: false | ||
}, { | ||
pred: { eq: ['audit', false] }, /* eq: booleans, != */ | ||
values: { 'audit': false }, | ||
result: true | ||
}, { | ||
pred: { ne: ['hostname', 'tony'] }, /* ne: strings, != */ | ||
@@ -54,2 +70,18 @@ values: { 'hostname': 'louie' }, | ||
}, { | ||
pred: { ne: ['audit', true] }, /* ne: booleans, == */ | ||
values: { 'audit': true }, | ||
result: false | ||
}, { | ||
pred: { ne: ['audit', false] }, /* ne: booleans, == */ | ||
values: { 'audit': true }, | ||
result: true | ||
}, { | ||
pred: { ne: ['audit', true] }, /* ne: booleans, != */ | ||
values: { 'audit': false }, | ||
result: true | ||
}, { | ||
pred: { ne: ['audit', false] }, /* ne: booleans, != */ | ||
values: { 'audit': false }, | ||
result: false | ||
}, { | ||
pred: { le: ['pid', 10] }, /* le: <, =, > */ | ||
@@ -56,0 +88,0 @@ values: { 'pid': 5 }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52880
1031