Skip to content

Consolidate duplicated utilities into shared/ - #654

Merged
geoffrey-wu merged 6 commits into
mainfrom
refactor-shared-utils
Oct 28, 2026
Merged

geoffrey-wu merged 6 commits into
mainfrom
refactor-shared-utils

Conversation

@geoffrey-wu

@geoffrey-wu geoffrey-wu commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add escapeRegExp in shared/string-utils.js and replace the two identical copies in database/qbreader/get-query.js and get-pg-lookup.js.
  • Add escapeCSVField in shared/string-utils.js and replace the three separate CSV escapers (client/scripts/download.js, client/db/frequency-list/subcategory.jsx, client/play/geoword/admin/users.js). The geoword users export keeps its formula-injection guard via { neutralizeFormulas: true }; other exports are unchanged in that respect.
  • Remove the local titleCase in subcategory.jsx in favor of shared/string-utils.js.

Behavior notes

  • Line breaks in CSV fields are now consistently written as a literal \n (previously download.js handled only \n, and the geoword users export left them raw).

Not changed

  • Stats CSV exports (client/user/stats/*) still use row.join(',').
  • users.js still builds its own Blob; downloadAsFile uses a data URI, which can hit size limits on large exports.

Test plan

  • npx semistandard, npm run build
  • Spot-checked both helpers in node
  • Download CSV from the db page, frequency list, and geoword admin users page

🤖 Generated with Claude Code

geoffrey-wu and others added 6 commits October 27, 2026 22:52
… shared/

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@geoffrey-wu
geoffrey-wu merged commit 6ecb6aa into main Oct 28, 2026
2 checks passed
@geoffrey-wu
geoffrey-wu deleted the refactor-shared-utils branch October 31, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant