UNPKG

1.49 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _operator = require('./operator');
8
9var _operator2 = _interopRequireDefault(_operator);
10
11function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13var Operators = [];
14Operators.push(new _operator2.default('equal', function (a, b) {
15 return a === b;
16}));
17Operators.push(new _operator2.default('notEqual', function (a, b) {
18 return a !== b;
19}));
20Operators.push(new _operator2.default('in', function (a, b) {
21 return b.indexOf(a) > -1;
22}));
23Operators.push(new _operator2.default('notIn', function (a, b) {
24 return b.indexOf(a) === -1;
25}));
26
27Operators.push(new _operator2.default('contains', function (a, b) {
28 return a.indexOf(b) > -1;
29}, Array.isArray));
30Operators.push(new _operator2.default('doesNotContain', function (a, b) {
31 return a.indexOf(b) === -1;
32}, Array.isArray));
33
34function numberValidator(factValue) {
35 return Number.parseFloat(factValue).toString() !== 'NaN';
36}
37Operators.push(new _operator2.default('lessThan', function (a, b) {
38 return a < b;
39}, numberValidator));
40Operators.push(new _operator2.default('lessThanInclusive', function (a, b) {
41 return a <= b;
42}, numberValidator));
43Operators.push(new _operator2.default('greaterThan', function (a, b) {
44 return a > b;
45}, numberValidator));
46Operators.push(new _operator2.default('greaterThanInclusive', function (a, b) {
47 return a >= b;
48}, numberValidator));
49
50exports.default = Operators;
\No newline at end of file