UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

30 lines (29 loc) • 830 B
import { t as parseByteSize } from "./parse-bytes-9fhYT3K0.mjs"; //#region src/config/byte-size.ts /** * Parse an optional byte-size value from config. * Accepts non-negative numbers or strings like "2mb". */ function parseNonNegativeByteSize(e) { if (typeof e === "number") { const t = Math.floor(e); return Number.isSafeInteger(t) && t >= 0 ? t : null; } if (typeof e === "string") { const t = e.trim(); if (!t) return null; try { const e = parseByteSize(t); return e >= 0 ? e : null; } catch { return null; } } return null; } /** Validates byte-size strings accepted by agent default byte-threshold config. */ function isValidNonNegativeByteSizeString(e) { return parseNonNegativeByteSize(e) !== null; } //#endregion export { parseNonNegativeByteSize as n, isValidNonNegativeByteSizeString as t };