refactor: adopt POSITIONS constants, fix ESLint warnings, break menuUtils into modules
- Replace hardcoded position strings with POSITIONS.* constants - Prefix unused variables with _ to resolve no-unused-vars warnings - Fix no-prototype-builtins with Object.prototype.hasOwnProperty.call() - Extract menuUtils.js (543 lines) into 6 focused modules under menu/ - menuUtils.js now 35 lines, delegates via prototype mixin pattern - Add 158 unit tests for ConfigManager, MeasurementContainer, ValidationUtils Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ class OutputUtils {
|
||||
checkForChanges(output, format) {
|
||||
const changedFields = {};
|
||||
for (const key in output) {
|
||||
if (output.hasOwnProperty(key) && output[key] !== this.output[format][key]) {
|
||||
if (Object.prototype.hasOwnProperty.call(output, key) && output[key] !== this.output[format][key]) {
|
||||
let value = output[key];
|
||||
// For fields: if the value is an object (and not a Date), stringify it.
|
||||
if (value !== null && typeof value === 'object' && !(value instanceof Date)) {
|
||||
@@ -81,13 +81,13 @@ class OutputUtils {
|
||||
flattenTags(obj) {
|
||||
const result = {};
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
const value = obj[key];
|
||||
if (value !== null && typeof value === 'object' && !(value instanceof Date)) {
|
||||
// Recursively flatten the nested object.
|
||||
const flatChild = this.flattenTags(value);
|
||||
for (const childKey in flatChild) {
|
||||
if (flatChild.hasOwnProperty(childKey)) {
|
||||
if (Object.prototype.hasOwnProperty.call(flatChild, childKey)) {
|
||||
result[`${key}_${childKey}`] = String(flatChild[childKey]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user