import { xCheck } from "./xCheck.js";
import { xGetFromToIndex } from "./xGetFromToIndex.js";
/**
 * Calculate the sum of the values
 * @param array - object that contains property x (an ordered increasing array) and y (an array).
 * @param options - options.
 * @returns sum value on the specified range.
 */
export function xSum(array, options = {}) {
    xCheck(array);
    const { fromIndex, toIndex } = xGetFromToIndex(array, options);
    let sumValue = array[fromIndex];
    for (let i = fromIndex + 1; i <= toIndex; i++) {
        sumValue += array[i];
    }
    return sumValue;
}
//# sourceMappingURL=xSum.js.map