spring-filter-query-builder
Version:
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
176 lines (175 loc) • 6.2 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 __());
};
})();
import { valuesToValue } from './item';
var Comparator = /** @class */ (function () {
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function Comparator(selector, comparatorKeyWord, value) {
this.selector = selector;
this.comparatorKeyWord = comparatorKeyWord;
this.value = value;
}
Comparator.prototype.toString = function () {
if (typeof this.value === 'undefined' || this.value === null) {
return this.selector + " " + this.comparatorKeyWord;
}
if (typeof this.value === 'number') {
return this.selector + " " + this.comparatorKeyWord + " " + this.value;
}
else {
return this.selector + " " + this.comparatorKeyWord + " '" + this.value + "'";
}
};
return Comparator;
}());
export { Comparator };
var Like = /** @class */ (function (_super) {
__extends(Like, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function Like(selector, value, caseInsensitive) {
if (caseInsensitive === void 0) { caseInsensitive = false; }
return _super.call(this, selector, caseInsensitive ? '~~' : '~', value) || this;
}
return Like;
}(Comparator));
export { Like };
var Equal = /** @class */ (function (_super) {
__extends(Equal, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function Equal(selector, value) {
return _super.call(this, selector, ':', value) || this;
}
return Equal;
}(Comparator));
export { Equal };
var NotEqual = /** @class */ (function (_super) {
__extends(NotEqual, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function NotEqual(selector, value) {
return _super.call(this, selector, '!', value) || this;
}
return NotEqual;
}(Comparator));
export { NotEqual };
var Gt = /** @class */ (function (_super) {
__extends(Gt, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function Gt(selector, value) {
return _super.call(this, selector, '>', value) || this;
}
return Gt;
}(Comparator));
export { Gt };
var Ge = /** @class */ (function (_super) {
__extends(Ge, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function Ge(selector, value) {
return _super.call(this, selector, '>:', value) || this;
}
return Ge;
}(Comparator));
export { Ge };
var Lt = /** @class */ (function (_super) {
__extends(Lt, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function Lt(selector, value) {
return _super.call(this, selector, '<', value) || this;
}
return Lt;
}(Comparator));
export { Lt };
var Le = /** @class */ (function (_super) {
__extends(Le, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function Le(selector, value) {
return _super.call(this, selector, '<:', value) || this;
}
return Le;
}(Comparator));
export { Le };
var IsNull = /** @class */ (function (_super) {
__extends(IsNull, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function IsNull(selector) {
return _super.call(this, selector, 'is null') || this;
}
return IsNull;
}(Comparator));
export { IsNull };
var IsNotNull = /** @class */ (function (_super) {
__extends(IsNotNull, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function IsNotNull(selector) {
return _super.call(this, selector, 'is not null') || this;
}
return IsNotNull;
}(Comparator));
export { IsNotNull };
var IsEmpty = /** @class */ (function (_super) {
__extends(IsEmpty, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function IsEmpty(selector) {
return _super.call(this, selector, 'is empty') || this;
}
return IsEmpty;
}(Comparator));
export { IsEmpty };
var IsNotEmpty = /** @class */ (function (_super) {
__extends(IsNotEmpty, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function IsNotEmpty(selector) {
return _super.call(this, selector, 'is not empty') || this;
}
return IsNotEmpty;
}(Comparator));
export { IsNotEmpty };
var In = /** @class */ (function (_super) {
__extends(In, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function In(selector, values) {
return _super.call(this, selector, 'in', "[" + valuesToValue(values) + "]") || this;
}
In.prototype.toString = function () {
return this.selector + " " + this.comparatorKeyWord + " " + this.value;
};
return In;
}(Comparator));
export { In };
var NotIn = /** @class */ (function (_super) {
__extends(NotIn, _super);
// false positive
// eslint-disable-next-line @typescript-eslint/ban-types
function NotIn(selector, values) {
return _super.call(this, selector, 'not in', "[" + valuesToValue(values) + "]") || this;
}
NotIn.prototype.toString = function () {
return this.selector + " " + this.comparatorKeyWord + " " + this.value;
};
return NotIn;
}(Comparator));
export { NotIn };