@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
15 lines (14 loc) • 514 B
JavaScript
const invalidItemKeyType = "Invalid set action items, 'relIndex' must be a positive integer";
export function checkSetActionItemKeysAreValid(p) {
if (!p.items?.length)
return true;
const items = p.items;
for (let i = items.length - 1; i >= 0; i--) {
const x = items[i];
if (typeof x.relIndex !== "number" || x.relIndex < 0 || Math.floor(x.relIndex) !== x.relIndex) {
console.error(invalidItemKeyType, p);
return false;
}
}
return true;
}