Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: solve various todos #649

Merged
merged 8 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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