Skip to content

feat: casing for random words (lorem.word / lorem.words casing option) - #3960

Open
hazrid93 wants to merge 1 commit into
faker-js:nextfrom
hazrid93:hazrid93/83_2165
Open

feat: casing for random words (lorem.word / lorem.words casing option)#3960
hazrid93 wants to merge 1 commit into
faker-js:nextfrom
hazrid93:hazrid93/83_2165

Conversation

@hazrid93

Copy link
Copy Markdown

Closes #2165.

Add a casing?: 'lower' | 'upper' | 'capital' | 'mixed' option to lorem.word (and a matching options param to lorem.words that threads it to each generated word). 'mixed' (the default) leaves the word's original casing unchanged, so existing default behavior (and snapshots) are unaffected. 'lower'/'upper'/'capital' apply lower/upper/capitalize.

@hazrid93
hazrid93 requested a review from a team as a code owner July 20, 2026 10:44
@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for fakerjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit bae1aa8
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/6a5e1ab155c2f5000896b38f
😎 Deploy Preview https://deploy-preview-3960.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@ST-DDT ST-DDT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CI is failing. Please run pnpn run preflight before commiting.

@ST-DDT
ST-DDT marked this pull request as draft July 20, 2026 12:05
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.88%. Comparing base (9ce88ce) to head (bae1aa8).
⚠️ Report is 4 commits behind head on next.

Files with missing lines Patch % Lines
src/modules/lorem/module.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3960      +/-   ##
==========================================
- Coverage   98.91%   98.88%   -0.03%     
==========================================
  Files         923      924       +1     
  Lines        3223     3232       +9     
  Branches      567      588      +21     
==========================================
+ Hits         3188     3196       +8     
- Misses         31       32       +1     
  Partials        4        4              
Files with missing lines Coverage Δ
src/modules/lorem/module.ts 97.50% <90.90%> (-2.50%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Closes faker-js#2165.

Add a `casing?: 'lower' | 'upper' | 'capital' | 'mixed'` option to lorem.word (and a matching options param to lorem.words that threads it to each generated word). 'mixed' (the default) leaves the word's original casing unchanged, so existing default behavior (and snapshots) are unaffected. 'lower'/'upper'/'capital' apply lower/upper/capitalize.
@ST-DDT
ST-DDT requested a review from Copilot July 20, 2026 13:01
@ST-DDT ST-DDT added c: feature Request for new feature p: 1-normal Nothing urgent s: pending triage Pending Triage m: lorem Something is referring to the lorem module labels Jul 20, 2026
@ST-DDT
ST-DDT marked this pull request as ready for review July 20, 2026 13:02

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

This PR adds a casing option to lorem.word() and threads a matching option through lorem.words(), enabling callers to request 'lower', 'upper', 'capital', or 'mixed' casing while preserving the existing default behavior.

Changes:

  • Introduces an applyCasing() helper and a casing option for lorem.word().
  • Extends lorem.words() with an optional options parameter and applies casing per generated word.
  • Updates JSDoc to document the new casing behavior and examples.

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

Comment thread src/modules/lorem/module.ts
*
* @default 'mixed'
*/
casing?: 'lower' | 'upper' | 'capital' | 'mixed';
*
* @default 'mixed'
*/
casing?: 'lower' | 'upper' | 'capital' | 'mixed';
wordList: this.faker.definitions.lorem.word,
})
);
return applyCasing(word, options.casing);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: feature Request for new feature m: lorem Something is referring to the lorem module p: 1-normal Nothing urgent s: pending triage Pending Triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

casing for random words

3 participants