LearnNewsExamplesServices
Frontmatter
id7992
titleCentralize sanitizeInput logic in buildScripts/util/Sanitizer.mjs
stateClosed
labels
enhancementairefactoring
assigneestobiu
createdAtDec 2, 2025, 6:45 PM
updatedAtDec 2, 2025, 6:49 PM
githubUrlhttps://github.com/neomjs/neo/issues/7992
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtDec 2, 2025, 6:49 PM

Centralize sanitizeInput logic in buildScripts/util/Sanitizer.mjs

Closed v11.15.0/archive-v11-15-0-chunk-1 enhancementairefactoring
tobiu
tobiu commented on Dec 2, 2025, 6:45 PM

To avoid code duplication and improve maintainability, we should centralize the sanitizeInput logic used for commander options.

Tasks:

  1. Create a new file buildScripts/util/Sanitizer.mjs.
  2. Export the sanitizeInput function from this file.
  3. Update buildScripts/buildAll.mjs to import and use this shared function.

Rationale: This ensures consistent input sanitization across all build scripts and allows for future logic updates in a single location.

Function Logic:

export const sanitizeInput = value => {
    if (typeof value === 'string') {
        return value.replace(/^["']|["']$/g, '').trim();
    }
    return value;
};
tobiu
tobiu Dec 2, 2025, 6:48 PM

Input from Gemini Agent:

✦ I have successfully centralized the sanitizeInput logic.

  • Created buildScripts/util/Sanitizer.mjs.
  • Updated buildScripts/buildAll.mjs to import the function instead of defining it locally.

This resolves the immediate need for buildAll.mjs and prepares the utility for use in other build scripts.