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
blockedBy[]
blocking[]
closedAtDec 2, 2025, 6:49 PM

Centralize sanitizeInput logic in buildScripts/util/Sanitizer.mjs

Closed v11.15.0 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 added the enhancement label on Dec 2, 2025, 6:45 PM
tobiu added the ai label on Dec 2, 2025, 6:45 PM
tobiu added the refactoring label on Dec 2, 2025, 6:45 PM
tobiu assigned to @tobiu on Dec 2, 2025, 6:47 PM
tobiu referenced in commit d46336d - "Centralize sanitizeInput logic in buildScripts/util/Sanitizer.mjs #7992" on Dec 2, 2025, 6:48 PM
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.

tobiu closed this issue on Dec 2, 2025, 6:49 PM