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