Skip to content

Commit

Permalink
docs: improve company jsdocs (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Feb 6, 2022
1 parent e618a4b commit 7d9ae2f
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions src/company.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import type { Fake } from './fake';

let f: Fake['fake'];

/**
* Module to generate company related entries.
*/
export class Company {
constructor(private readonly faker: Faker) {
f = this.faker.fake;
Expand All @@ -17,20 +20,22 @@ export class Company {
}

/**
* suffixes
* Returns an array with possible company name suffixes.
*
* @method faker.company.suffixes
* @example
* faker.company.suffixes() // [ 'Inc', 'and Sons', 'LLC', 'Group' ]
*/
suffixes(): string[] {
// Don't want the source array exposed to modification, so return a copy
return this.faker.definitions.company.suffix.slice(0);
}

/**
* companyName
* Generates a random company name.
* @param format The optional format index used to select a format.
*
* @method faker.company.companyName
* @param format
* @example
* faker.company.companyName() // 'Zieme, Hauck and McClure'
*/
companyName(format?: number): string {
const formats = [
Expand All @@ -47,18 +52,20 @@ export class Company {
}

/**
* companySuffix
* Returns a random company suffix.
*
* @method faker.company.companySuffix
* @example
* faker.company.companySuffix() // 'and Sons'
*/
companySuffix(): string {
return this.faker.random.arrayElement(this.faker.company.suffixes());
}

/**
* catchPhrase
* Generates a random business catch phrase.
*
* @method faker.company.catchPhrase
* @example
* faker.company.catchPhrase() // 'Upgradable systematic flexibility'
*/
catchPhrase(): string {
return f(
Expand All @@ -67,18 +74,20 @@ export class Company {
}

/**
* bs
* Generates a random company bs phrase.
*
* @method faker.company.bs
* @example
* faker.company.bs() // 'cultivate synergistic e-markets'
*/
bs(): string {
return f('{{company.bsBuzz}} {{company.bsAdjective}} {{company.bsNoun}}');
}

/**
* catchPhraseAdjective
* Returns a random catch phrase adjective.
*
* @method faker.company.catchPhraseAdjective
* @example
* faker.company.catchPhraseAdjective() // 'Multi-tiered'
*/
catchPhraseAdjective(): string {
return this.faker.random.arrayElement(
Expand All @@ -87,9 +96,10 @@ export class Company {
}

/**
* catchPhraseDescriptor
* Returns a random catch phrase descriptor.
*
* @method faker.company.catchPhraseDescriptor
* @example
* faker.company.catchPhraseDescriptor() // 'composite'
*/
catchPhraseDescriptor(): string {
return this.faker.random.arrayElement(
Expand All @@ -98,18 +108,20 @@ export class Company {
}

/**
* catchPhraseNoun
* Returns a random catch phrase noun.
*
* @method faker.company.catchPhraseNoun
* @example
* faker.company.catchPhraseNoun() // 'leverage'
*/
catchPhraseNoun(): string {
return this.faker.random.arrayElement(this.faker.definitions.company.noun);
}

/**
* bsAdjective
* Returns a random company bs adjective.
*
* @method faker.company.bsAdjective
* @example
* faker.company.bsAdjective() // 'one-to-one'
*/
bsAdjective(): string {
return this.faker.random.arrayElement(
Expand All @@ -118,9 +130,10 @@ export class Company {
}

/**
* bsBuzz
* Returns a random company bs buzz word.
*
* @method faker.company.bsBuzz
* @example
* faker.company.bsBuzz() // 'empower'
*/
bsBuzz(): string {
return this.faker.random.arrayElement(
Expand All @@ -129,9 +142,10 @@ export class Company {
}

/**
* bsNoun
* Returns a random company bs noun.
*
* @method faker.company.bsNoun
* @example
* faker.company.bsNoun() // 'paradigms'
*/
bsNoun(): string {
return this.faker.random.arrayElement(
Expand Down

0 comments on commit 7d9ae2f

Please sign in to comment.