Skip to content

Commit

Permalink
fix: solve various todos (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Mar 24, 2022
1 parent fe62c19 commit d0a473f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
9 changes: 1 addition & 8 deletions src/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 0 additions & 2 deletions src/faker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 11 additions & 1 deletion src/internet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
13 changes: 2 additions & 11 deletions src/lorem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) + '.';
Expand Down Expand Up @@ -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()
Expand All @@ -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',
Expand Down

0 comments on commit d0a473f

Please sign in to comment.