@azure/cosmos
Version:
Microsoft Azure Cosmos DB Service Node.js SDK for NOSQL API
63 lines (62 loc) • 2.02 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var MinAggregator_exports = {};
__export(MinAggregator_exports, {
MinAggregator: () => MinAggregator
});
module.exports = __toCommonJS(MinAggregator_exports);
var import_orderByDocumentProducerComparator = require("../orderByDocumentProducerComparator.js");
class MinAggregator {
value;
comparer;
/**
* Represents an aggregator for MIN operator.
* @hidden
*/
constructor() {
this.value = void 0;
this.comparer = new import_orderByDocumentProducerComparator.OrderByDocumentProducerComparator(["Ascending"]);
}
/**
* Add the provided item to aggregation result.
*/
aggregate(other) {
if (other.min === void 0) {
return;
}
if (this.value === void 0) {
this.value = other.min;
} else {
const otherType = other.min === null ? "NoValue" : typeof other.min;
const thisType = this.value === null ? "NoValue" : typeof this.value;
if (this.comparer.compareValue(other.min, otherType, this.value, thisType) < 0) {
this.value = other.min;
}
}
}
/**
* Get the aggregation result.
*/
getResult() {
return this.value;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
MinAggregator
});