UNPKG

@bitrix24/b24jssdk

Version:

Bitrix24 REST API JavaScript SDK

49 lines (47 loc) • 1.73 kB
/** * @package @bitrix24/b24jssdk * @version 3.0.0 * @copyright (c) 2026 Bitrix24 * @license MIT * @see https://github.com/bitrix24/b24jssdk * @see https://bitrix24.github.io/b24jssdk/ */ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); const ISO_DATETIME = /^\d{4}-\d{2}-\d{2}([T ])\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}:?\d{2})$/; const DIGITS_ONLY = /^\d+$/; function resolveCursorDirection(order) { return DESC_ORDER.test(order) ? "DESC" : "ASC"; } __name(resolveCursorDirection, "resolveCursorDirection"); const DESC_ORDER = /desc/i; function isComparableCursorPair(next, previous) { if ("number" === typeof next && "number" === typeof previous) { return Number.isFinite(next) && Number.isFinite(previous); } if ("string" === typeof next && "string" === typeof previous) { if (next.length !== previous.length) { return false; } if (DIGITS_ONLY.test(next) && DIGITS_ONLY.test(previous)) { return true; } const nextIso = ISO_DATETIME.exec(next); const previousIso = ISO_DATETIME.exec(previous); return null !== nextIso && null !== previousIso && nextIso[1] === previousIso[1] && nextIso[2] === previousIso[2]; } return false; } __name(isComparableCursorPair, "isComparableCursorPair"); function cursorProgressed(next, previous, direction) { if (next === previous) { return false; } if (!isComparableCursorPair(next, previous)) { return true; } return "DESC" === direction ? next < previous : next > previous; } __name(cursorProgressed, "cursorProgressed"); export { DESC_ORDER, cursorProgressed, resolveCursorDirection }; //# sourceMappingURL=_cursor-progress.mjs.map