spring-filter-query-builder
Version:
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
68 lines (67 loc) • 2.45 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Exists = exports.Not = exports.Or = exports.And = exports.Operator = void 0;
var Operator = /** @class */ (function () {
function Operator(operatorKeyWord, items) {
this.operatorKeyWord = operatorKeyWord;
this.items = items;
}
Operator.prototype.toString = function () {
return '(' + this.items.map(function (item) { return item.toString(); }).join(" " + this.operatorKeyWord + " ") + ')';
};
return Operator;
}());
exports.Operator = Operator;
var And = /** @class */ (function (_super) {
__extends(And, _super);
function And(items) {
return _super.call(this, 'and', items) || this;
}
return And;
}(Operator));
exports.And = And;
var Or = /** @class */ (function (_super) {
__extends(Or, _super);
function Or(items) {
return _super.call(this, 'or', items) || this;
}
return Or;
}(Operator));
exports.Or = Or;
var Not = /** @class */ (function (_super) {
__extends(Not, _super);
function Not(item) {
return _super.call(this, 'not', [item]) || this;
}
Not.prototype.toString = function () {
if (this.items[0] instanceof Operator) {
return "" + this.operatorKeyWord + this.items[0].toString();
}
return this.operatorKeyWord + "(" + this.items[0].toString() + ")";
};
return Not;
}(Operator));
exports.Not = Not;
var Exists = /** @class */ (function (_super) {
__extends(Exists, _super);
function Exists(item) {
return _super.call(this, 'exists', [item]) || this;
}
return Exists;
}(Operator));
exports.Exists = Exists;
;