refactor: underscore-prefix all non-exported functions

This commit is contained in:
c0dev0id
2026-07-06 21:14:36 +02:00
parent 3beaa1d2ec
commit 884955195a
4 changed files with 120 additions and 120 deletions

View File

@@ -4,13 +4,13 @@ import { getKindGroups } from '../subobject-kinds.js';
// Strip the final maximal run of same-class characters (all-digits or all-non-digits)
// from the ID tail. Everything before that run is the group key.
function barGroupKey(id) {
function _barGroupKey(id) {
const m = id.match(/(\d+|\D+)$/);
return m ? id.slice(0, m.index) : id;
}
// Increment the trailing numeric run of an ID, preserving zero-padding width.
function incrementId(id) {
function _incrementId(id) {
const m = id.match(/(\d+)$/);
if (!m) return id + '1';
const num = parseInt(m[1], 10) + 1;
@@ -70,10 +70,10 @@ export const PaneSubObjects = {
if (!model) return;
let newId;
if (afterId) {
newId = incrementId(afterId);
newId = _incrementId(afterId);
} else {
const liveBars = (model.bars ?? []).filter(b => !b.deleted);
newId = liveBars.length ? incrementId(liveBars[liveBars.length - 1].id) : 'bar001';
newId = liveBars.length ? _incrementId(liveBars[liveBars.length - 1].id) : 'bar001';
}
const newBar = {
type: 'bar', id: newId, isDirty: true, isNew: true,
@@ -103,7 +103,7 @@ export const PaneSubObjects = {
const barGroups = [];
const seen = new Map();
for (const item of visibleItems) {
const key = barGroupKey(item.label);
const key = _barGroupKey(item.label);
if (!seen.has(key)) {
const g = { key, items: [] };
barGroups.push(g);