UNPKG

2.6 kBJavaScriptView Raw
1/**
2 *
3 * @namespace faker.company
4 */
5var Company = function (faker) {
6
7 var self = this;
8 var f = faker.fake;
9
10 /**
11 * suffixes
12 *
13 * @method faker.company.suffixes
14 */
15 this.suffixes = function () {
16 // Don't want the source array exposed to modification, so return a copy
17 return faker.definitions.company.suffix.slice(0);
18 }
19
20 /**
21 * companyName
22 *
23 * @method faker.company.companyName
24 * @param {string} format
25 */
26 this.companyName = function (format) {
27
28 var formats = [
29 '{{name.lastName}} {{company.companySuffix}}',
30 '{{name.lastName}} - {{name.lastName}}',
31 '{{name.lastName}}, {{name.lastName}} and {{name.lastName}}'
32 ];
33
34 if (typeof format !== "number") {
35 format = faker.datatype.number(formats.length - 1);
36 }
37
38 return f(formats[format]);
39 }
40
41 /**
42 * companySuffix
43 *
44 * @method faker.company.companySuffix
45 */
46 this.companySuffix = function () {
47 return faker.random.arrayElement(faker.company.suffixes());
48 }
49
50 /**
51 * catchPhrase
52 *
53 * @method faker.company.catchPhrase
54 */
55 this.catchPhrase = function () {
56 return f('{{company.catchPhraseAdjective}} {{company.catchPhraseDescriptor}} {{company.catchPhraseNoun}}')
57 }
58
59 /**
60 * bs
61 *
62 * @method faker.company.bs
63 */
64 this.bs = function () {
65 return f('{{company.bsBuzz}} {{company.bsAdjective}} {{company.bsNoun}}');
66 }
67
68 /**
69 * catchPhraseAdjective
70 *
71 * @method faker.company.catchPhraseAdjective
72 */
73 this.catchPhraseAdjective = function () {
74 return faker.random.arrayElement(faker.definitions.company.adjective);
75 }
76
77 /**
78 * catchPhraseDescriptor
79 *
80 * @method faker.company.catchPhraseDescriptor
81 */
82 this.catchPhraseDescriptor = function () {
83 return faker.random.arrayElement(faker.definitions.company.descriptor);
84 }
85
86 /**
87 * catchPhraseNoun
88 *
89 * @method faker.company.catchPhraseNoun
90 */
91 this.catchPhraseNoun = function () {
92 return faker.random.arrayElement(faker.definitions.company.noun);
93 }
94
95 /**
96 * bsAdjective
97 *
98 * @method faker.company.bsAdjective
99 */
100 this.bsAdjective = function () {
101 return faker.random.arrayElement(faker.definitions.company.bs_adjective);
102 }
103
104 /**
105 * bsBuzz
106 *
107 * @method faker.company.bsBuzz
108 */
109 this.bsBuzz = function () {
110 return faker.random.arrayElement(faker.definitions.company.bs_verb);
111 }
112
113 /**
114 * bsNoun
115 *
116 * @method faker.company.bsNoun
117 */
118 this.bsNoun = function () {
119 return faker.random.arrayElement(faker.definitions.company.bs_noun);
120 }
121
122}
123
124module['exports'] = Company;
\No newline at end of file