faker-js / faker

Generate massive amounts of fake data in the browser and node.js
https://fakerjs.dev
Other
11.86k stars 877 forks source link

feat(word): add method for generating letter #2836

Closed Shinigami92 closed 3 weeks ago

Shinigami92 commented 3 weeks ago

closes #558

netlify[bot] commented 3 weeks ago

Deploy Preview for fakerjs ready!

Name Link
Latest commit 9de15c8d0cf3d4ef858c227cfe0815f6011ba93d
Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/66223779f38b3f0008398837
Deploy Preview https://deploy-preview-2836.fakerjs.dev
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.95%. Comparing base (48ab524) to head (9de15c8).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## next #2836 +/- ## ========================================== - Coverage 99.95% 99.95% -0.01% ========================================== Files 2964 2968 +4 Lines 212544 212673 +129 Branches 945 945 ========================================== + Hits 212457 212585 +128 - Misses 87 88 +1 ``` | [Files](https://app.codecov.io/gh/faker-js/faker/pull/2836?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js) | Coverage Δ | | |---|---|---| | [src/locales/de/word/index.ts](https://app.codecov.io/gh/faker-js/faker/pull/2836?src=pr&el=tree&filepath=src%2Flocales%2Fde%2Fword%2Findex.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js#diff-c3JjL2xvY2FsZXMvZGUvd29yZC9pbmRleC50cw==) | `100.00% <100.00%> (ø)` | | | [src/locales/de/word/letter.ts](https://app.codecov.io/gh/faker-js/faker/pull/2836?src=pr&el=tree&filepath=src%2Flocales%2Fde%2Fword%2Fletter.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js#diff-c3JjL2xvY2FsZXMvZGUvd29yZC9sZXR0ZXIudHM=) | `100.00% <100.00%> (ø)` | | | [src/locales/el/index.ts](https://app.codecov.io/gh/faker-js/faker/pull/2836?src=pr&el=tree&filepath=src%2Flocales%2Fel%2Findex.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js#diff-c3JjL2xvY2FsZXMvZWwvaW5kZXgudHM=) | `100.00% <100.00%> (ø)` | | | [src/locales/el/word/index.ts](https://app.codecov.io/gh/faker-js/faker/pull/2836?src=pr&el=tree&filepath=src%2Flocales%2Fel%2Fword%2Findex.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js#diff-c3JjL2xvY2FsZXMvZWwvd29yZC9pbmRleC50cw==) | `100.00% <100.00%> (ø)` | | | [src/locales/el/word/letter.ts](https://app.codecov.io/gh/faker-js/faker/pull/2836?src=pr&el=tree&filepath=src%2Flocales%2Fel%2Fword%2Fletter.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js#diff-c3JjL2xvY2FsZXMvZWwvd29yZC9sZXR0ZXIudHM=) | `100.00% <100.00%> (ø)` | | | [src/locales/en/word/index.ts](https://app.codecov.io/gh/faker-js/faker/pull/2836?src=pr&el=tree&filepath=src%2Flocales%2Fen%2Fword%2Findex.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js#diff-c3JjL2xvY2FsZXMvZW4vd29yZC9pbmRleC50cw==) | `100.00% <100.00%> (ø)` | | | [src/locales/en/word/letter.ts](https://app.codecov.io/gh/faker-js/faker/pull/2836?src=pr&el=tree&filepath=src%2Flocales%2Fen%2Fword%2Fletter.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js#diff-c3JjL2xvY2FsZXMvZW4vd29yZC9sZXR0ZXIudHM=) | `100.00% <100.00%> (ø)` | | | [src/modules/word/index.ts](https://app.codecov.io/gh/faker-js/faker/pull/2836?src=pr&el=tree&filepath=src%2Fmodules%2Fword%2Findex.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js#diff-c3JjL21vZHVsZXMvd29yZC9pbmRleC50cw==) | `98.92% <100.00%> (+0.04%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/faker-js/faker/pull/2836/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=faker-js)
ST-DDT commented 3 weeks ago

The referenced issue has barely any upvotes or comments. 🤔 So I consider it low prio. Also there is the current feature freezes to prepare for the v9 changes.

matthewmayer commented 3 weeks ago

The other problem with putting Greek letters in fakerEL is I cannot easily use it in a helpers.fake pattern

Eg if I want "Incredible Soft Gloves are located in Section A, subsection δ" I can't do

"{{commerce.productName}} are located in Section {{foo.romanLetter}} subsection {{foo.greekLetter}}"

Shinigami92 commented 3 weeks ago

The other problem with putting Greek letters in fakerEL is I cannot easily use it in a helpers.fake pattern

Eg if I want "Incredible Soft Gloves are located in Section A, subsection δ" I can't do

"{{commerce.productName}} are located in Section {{foo.romanLetter}} subsection {{foo.greekLetter}}"

Can you elaborate what this has to be done with this PR? Why does it not count for chemicalElement or airline? I think this might then be more a problem of fake and is out of scope for this PR and feature implementation.

Or did I get your intend wrong? You want to use greek (mixed locale) context inside fake? This is new to me 🤔 And if so, you could still generate all this just without using fake but just wrap in a function.

function x() {
  return `${faker.commerce.productName()} are located in Section ${faker.foo.romanLetter()} subsection ${fakerEL.word.letter()}`;
                                                                   ~~~~~~~~~~~~~~~~~~~~~~~ this does not even exists
}
matthewmayer commented 3 weeks ago

Greek/roman letters are "international"

Like even if you are writing English you might use single Greek letters for some things. Even if you are writing Chinese you might use single Roman letters for some things.

You can of course use string interpolation. But fake patterns can be used by other faker definitions so it's nice if they can access useful data.

Shinigami92 commented 3 weeks ago

As I don't feel healthy (again) anymore, I will close this for now