UNPKG

@azure/cosmos

Version:
59 lines (58 loc) 1.87 kB
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 MaxAggregator_exports = {}; __export(MaxAggregator_exports, { MaxAggregator: () => MaxAggregator }); module.exports = __toCommonJS(MaxAggregator_exports); var import_orderByDocumentProducerComparator = require("../orderByDocumentProducerComparator.js"); class MaxAggregator { value; comparer; /** * Represents an aggregator for MAX 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.max === void 0) { return; } if (this.value === void 0) { this.value = other.max; } else if (this.comparer.compareValue(other.max, typeof other.max, this.value, typeof this.value) > 0) { this.value = other.max; } } /** * Get the aggregation result. */ getResult() { return this.value; } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { MaxAggregator });