aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-03-24 09:26:11 +0100
committerGitHub <[email protected]>2022-03-24 08:26:11 +0000
commitd0a473f7ca6b525391ca8ab17e029335c66ed99e (patch)
treefa065390d28780d600343a1e8f57c921e3894d12 /src
parentfe62c1953c1b5755151c6d7562614f89733a6de1 (diff)
downloadfaker-d0a473f7ca6b525391ca8ab17e029335c66ed99e.tar.xz
faker-d0a473f7ca6b525391ca8ab17e029335c66ed99e.zip
fix: solve various todos (#649)
Diffstat (limited to 'src')
-rw-r--r--src/address.ts9
-rw-r--r--src/faker.ts2
-rw-r--r--src/internet.ts12
-rw-r--r--src/lorem.ts13
4 files changed, 14 insertions, 22 deletions
diff --git a/src/address.ts b/src/address.ts
index eff72f2f..ec137ad2 100644
--- a/src/address.ts
+++ b/src/address.ts
@@ -171,10 +171,6 @@ export class Address {
return result;
}
- //
- // TODO: change all these methods that accept a boolean to instead accept an options hash.
- //
-
/**
* Generates a random localized street address.
*
@@ -308,13 +304,10 @@ export class Address {
/**
* Returns a random localized state from this country.
*
- * @param useAbbr This parameter does nothing.
- *
* @example
* faker.address.state() // 'Georgia'
*/
- // TODO @Shinigami92 2022-01-13: useAbbr not in use
- state(useAbbr?: boolean): string {
+ state(): string {
return this.faker.random.arrayElement(this.faker.definitions.address.state);
}
diff --git a/src/faker.ts b/src/faker.ts
index 572bbaf2..e2530f16 100644
--- a/src/faker.ts
+++ b/src/faker.ts
@@ -70,8 +70,6 @@ export class Faker {
readonly finance = new Finance(this);
readonly git: Git = new Git(this);
readonly hacker: Hacker = new Hacker(this);
- // TODO @Shinigami92 2022-01-12: iban was not used
- // readonly iban = new (require('./iban'))(this);
readonly image: Image = new Image(this);
readonly internet: Internet = new Internet(this);
readonly lorem: Lorem = new Lorem(this);
diff --git a/src/internet.ts b/src/internet.ts
index f80059f9..f247f06b 100644
--- a/src/internet.ts
+++ b/src/internet.ts
@@ -203,8 +203,18 @@ export class Internet {
* @example
* faker.internet.ip() // '245.108.222.0'
*/
- // TODO @Shinigami92 2022-01-23: Add ipv4 alias
ip(): string {
+ // TODO @Shinigami92 2022-03-21: We may want to return a IPv4 or IPv6 address here in a later major release
+ return this.ipv4();
+ }
+
+ /**
+ * Generates a random IPv4 address.
+ *
+ * @example
+ * faker.internet.ipv4() // '245.108.222.0'
+ */
+ ipv4(): string {
const randNum = () => {
return this.faker.datatype.number(255).toFixed(0);
};
diff --git a/src/lorem.ts b/src/lorem.ts
index 296c88b5..4612fe2d 100644
--- a/src/lorem.ts
+++ b/src/lorem.ts
@@ -64,21 +64,15 @@ export class Lorem {
* Generates a space separated list of words beginning a capital letter and ending with a dot.
*
* @param wordCount The number of words, that should be in the sentence. Defaults to a random number between `3` and `10`.
- * @param range Currently this parameter does nothing.
*
* @example
* faker.lorem.sentence() // 'Voluptatum cupiditate suscipit autem eveniet aut dolorem aut officiis distinctio.'
* faker.lorem.sentence(5) // 'Laborum voluptatem officiis est et.'
*/
- // TODO @Shinigami92 2022-01-11: `range` is not in use
- sentence(wordCount?: number, range?: number): string {
+ sentence(wordCount?: number): string {
if (typeof wordCount === 'undefined') {
wordCount = this.faker.datatype.number({ min: 3, max: 10 });
}
- // if (typeof range == 'undefined') { range = 7; }
-
- // strange issue with the node_min_test failing for capitalize, please fix and add faker.lorem.back
- //return faker.lorem.words(wordCount + Helpers.randomNumber(range)).join(' ').capitalize();
const sentence = this.faker.lorem.words(wordCount);
return sentence.charAt(0).toUpperCase() + sentence.slice(1) + '.';
@@ -174,8 +168,6 @@ export class Lorem {
/**
* Generates a random text based on a random lorem method.
*
- * @param times This parameter does nothing.
- *
* @example
* faker.lorem.text() // 'Doloribus autem non quis vero quia.'
* faker.lorem.text()
@@ -185,8 +177,7 @@ export class Lorem {
* // Iure nam officia optio cumque.
* // Dolor tempora iusto.'
*/
- // TODO @Shinigami92 2022-01-11: `times` is not in use
- text(times?: number): string {
+ text(): string {
const loremMethods = [
'lorem.word',
'lorem.words',