UNPKG

on-codemerge

Version:

A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product

35 lines (34 loc) 1.65 kB
/*! on-codemerge v1.3.1 @author Pavel Kuzmin @license MIT @homepage https://s00d.github.io/on-codemerge/ @repository git+https://github.com/s00d/on-codemerge.git Copyright (c) 2026 Pavel Kuzmin - Built on 2026-07-02T13:39:17.947Z */ function s(r) { return r.data !== void 0 && Array.isArray(r.data); } function t(r) { return !r || !Array.isArray(r) || r.length === 0 ? (console.warn("Invalid chart data: Data must be a non-empty array"), !1) : s(r[0]) ? r.every((a) => { const e = a; return !e.data || !Array.isArray(e.data) || e.data.length === 0 ? (console.warn("Invalid series data: Each series must have a non-empty data array"), !1) : e.data.every((i) => n(i)); }) : r.every((a) => n(a)); } function n(r) { if (!r || typeof r != "object") return console.warn("Invalid point: Must be an object"), !1; if (!r.label || typeof r.label != "string") return console.warn("Invalid point: Missing or invalid label"), !1; if ("x" in r || "y" in r) { const a = typeof r.x == "number" && !isNaN(r.x), e = typeof r.y == "number" && !isNaN(r.y); return !a || !e ? (console.warn("Invalid point: XY charts require valid x and y values"), !1) : "r" in r && (typeof r.r != "number" || isNaN(r.r)) ? (console.warn("Invalid point: Bubble charts require valid radius (r) value"), !1) : !0; } return typeof r.value != "number" || isNaN(r.value) ? (console.warn("Invalid point: Missing or invalid value"), !1) : !0; } function l(r) { return r.length ? "data" in r[0] ? r : [ { name: "Series 1", data: r } ] : []; } export { s as isChartSeries, l as normalizeChartData, t as validateChartData };