Skip to content

Align /src parameter names for consistent language#219

Draft
jrmybtlr wants to merge 7 commits into
mainfrom
cursor/consistent-src-param-language-cd1c
Draft

Align /src parameter names for consistent language#219
jrmybtlr wants to merge 7 commits into
mainfrom
cursor/consistent-src-param-language-cd1c

Conversation

@jrmybtlr

@jrmybtlr jrmybtlr commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Reviewed /src function parameters for inconsistent naming and aligned related APIs to a shared vocabulary, including a single short/long display option across formatters.

Parameter language

  • Modifiers: string inputs use text; ordinalize uses number
  • Actions: debounce/throttle both use fn + delay
  • Numbers: margin/markup helpers use number instead of value
  • Goodies/Generators: checkPasswordStrength prefers numbers/symbols to match generatePassword, with legacy aliases kept

Short/long display options

All formatter short/long options are now display?: 'short' | 'long':

  • formatUnit, formatDurationLabels, formatCombinedDates, formatFileSize, formatLength, formatTemperature

Legacy aliases still work: unitDisplay, labels, monthDisplay, format.

Docs + nuxt-web demos/params updated.

Convention

Kind Name
Polymorphic validators value
Strings text
Scalar numbers number
Number arrays numbers
Callbacks fn
Wait (ms) delay
Short/long verbosity display: 'short' | 'long'

Test plan

  • pnpm test — 331 passed
  • tsc --noEmit clean
  • Legacy aliases covered by tests
Open in Web Open in Cursor 

Use shared vocabulary across related APIs: text for strings,
number for scalars, fn/delay for debounce and throttle, and
numbers/symbols for password options (with legacy aliases).

Co-authored-by: Jeremy Butler <jrmybtlr@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
usemods 1e1d801 Commit Preview URL

Branch Preview URL
Jul 25 2026, 12:13 AM

cursoragent and others added 2 commits July 23, 2026 21:34
Prefer unitDisplay for duration labels and monthDisplay for
combined dates, matching other formatter display options while
keeping labels/format as legacy aliases.

Co-authored-by: Jeremy Butler <jrmybtlr@users.noreply.github.com>
Use a single display option across unit, duration, date, file size,
length, and temperature formatters. Keep unitDisplay, labels,
monthDisplay, and format as legacy aliases.

Co-authored-by: Jeremy Butler <jrmybtlr@users.noreply.github.com>
@jrmybtlr

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns public API parameter naming across /src utilities to a consistent vocabulary, while preserving backwards compatibility via legacy option aliases and updating documentation/demos/tests accordingly.

Changes:

  • Standardizes parameter names across helpers (e.g., text, number, fn, delay) for consistency.
  • Unifies formatter short/long options under display?: 'short' | 'long' with legacy aliases supported.
  • Updates docs, nuxt-web demo components, and tests to reflect the new naming (and to cover aliases).

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tasks/todo.md Updates internal task notes to reflect the parameter-language convention work.
src/numbers.ts Renames margin/markup helper params to number for consistency.
src/modifiers.ts Renames string/number params (text, number) across modifier utilities.
src/goodies.ts Aligns password policy option keys (numbers, symbols) while keeping legacy aliases.
src/goodies.test.ts Updates/expands tests for new password option keys and legacy aliases.
src/formatters.ts Introduces display option and shared resolver to support legacy short/long aliases.
src/formatters.test.ts Adds/updates tests for display and legacy alias compatibility across formatters.
src/actions.ts Renames debounce callback param to fn and throttle interval param to delay.
nuxt-web/pages/docs/formatters.vue Updates docs page parameter strings to show display instead of legacy option names.
nuxt-web/components/content/formatters/FormatUnit.vue Updates demo UI/state to use display instead of unitDisplay.
nuxt-web/components/content/formatters/FormatTemperature.vue Updates demo UI/state to use display instead of unitDisplay.
nuxt-web/components/content/formatters/FormatLength.vue Updates demo UI/state to use display instead of unitDisplay.
nuxt-web/components/content/formatters/FormatFileSize.vue Updates demo UI/state to use display instead of unitDisplay.
nuxt-web/components/content/formatters/FormatDurationLabels.vue Updates demo UI/state to use display instead of labels.
nuxt-web/components/content/formatters/FormatCombinedDates.vue Updates demo UI/state to use display instead of format.
docs/pages/numbers.md Updates docs signatures/param names for number helpers.
docs/pages/modifiers.md Updates docs signatures/param names for modifier utilities.
docs/pages/goodies.md Updates docs for checkPasswordStrength option keys + notes aliases.
docs/pages/generators.md Updates docs for generatePassword option keys + notes aliases.
docs/pages/formatters.md Updates formatter docs to prefer display and document aliases.
docs/pages/actions.md Updates action docs to use fn + delay terminology.
Comments suppressed due to low confidence (2)

nuxt-web/components/content/formatters/FormatDurationLabels.vue:16

  • This <option> is hard-coded as selected even though the selection should be controlled by v-model. With the new "Default: 'long'" guidance, leaving selected here can cause the initial UI selection to disagree with the bound model (and can create SSR/hydration mismatches).

This issue also appears on line 43 of the same file.

        <option
          value="short"
          selected>
          Short
        </option>

nuxt-web/components/content/formatters/FormatDurationLabels.vue:43

  • The demo says "Default: 'long'" but initializes display to 'short', so the example UI/code doesn't match the documented default behavior of formatDurationLabels.
const display = ref<'long' | 'short'>('short')

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/goodies.ts Outdated
Comment on lines +71 to +73
if (counts.uppercase < uppercase) return { score: 1, label: `Password must contain ${uppercase} uppercase letter` }
if (counts.numbers < number) return { score: 1, label: `Password must contain ${number} number` }
if (counts.special < special) return { score: 1, label: `Password must contain ${special} special character` }
if (counts.numbers < numbers) return { score: 1, label: `Password must contain ${numbers} number` }
if (counts.symbols < symbols) return { score: 1, label: `Password must contain ${symbols} special character` }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6e62f6a — the failure labels now append 's' when the required count is greater than 1, so messages correctly read e.g. "Password must contain 2 uppercase letters" while preserving "1 uppercase letter".

Comment thread docs/pages/actions.md
Comment on lines +220 to 223
### `throttle<T extends (...args: unknown[]) => void>(fn: T, delay: number): ((...args: Parameters<T>) => void) & { cancel: () => void }`

Throttles a function to ensure it only runs once per threshold.
Throttles a function to ensure it only runs once per delay interval.

jrmybtlr added 2 commits July 24, 2026 15:44
…rmatCombinedDates

- Updated the `combineDates` function to use `display` instead of `format`, maintaining `format` as a legacy alias.
- Removed the `FormatCombinedDates.vue` component and its associated documentation.
- Adjusted parameter names in various components and tests to align with the new naming conventions (e.g., `threshold` to `delay`, `number` to `numbers`, `special` to `symbols`).
- Updated tests to reflect changes in parameter names and ensure compatibility with the new `display` option.
- Cleaned up documentation to remove references to deprecated features and ensure consistency across the codebase.
…tion

- Updated parameter names in various components to use consistent terminology (e.g., `value` to `text`, `value` to `number`).
- Adjusted the `GeneratePassword` component to improve clarity in input labels.
- Modified documentation in the `goodies`, `modifiers`, and `numbers` pages to reflect the new parameter names and descriptions.
- Ensured all changes align with the recent refactor for improved consistency and readability.
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.

4 participants