Skip to content

Commit 1445b1d

Browse files
authored
Merge pull request #36 from openlayers/preferred-types
Prefer Object to object
2 parents db98486 + 65a18b7 commit 1445b1d

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

examples/base/mod.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,66 @@ export function foo() {
88
// option for prettier if not.
99
return obj['bar'];
1010
}
11+
12+
/**
13+
* @typedef {Object} SoupOptions
14+
* @property {string} [type='chicken'] The type of soup.
15+
* @property {boolean} [noodles=false] Include noodles.
16+
* @property {Array<string>} [vegetables=[]] The vegetables.
17+
*/
18+
19+
/**
20+
* @classdesc
21+
* Soup.
22+
*
23+
* @api
24+
*/
25+
export class Soup {
26+
/**
27+
* Construct a soup.
28+
* @param {SoupOptions} options The soup options.
29+
*/
30+
constructor(options) {
31+
/**
32+
* @private
33+
* @type {string}
34+
*/
35+
this.type_ = options.type || 'chicken';
36+
37+
/**
38+
* @private
39+
* @type {boolean}
40+
*/
41+
this.noodles_ = !!options.noodles;
42+
43+
/**
44+
* @private
45+
* @type {Array<string>}
46+
*/
47+
this.vegetables_ = options.vegetables || [];
48+
}
49+
50+
/**
51+
* Get the soup type.
52+
* @return {string} The type of soup.
53+
*/
54+
getType() {
55+
return this.type_;
56+
}
57+
58+
/**
59+
* Check if the soup has noodles.
60+
* @return {boolean} The soup has noodles.
61+
*/
62+
hasNoodles() {
63+
return this.noodles_;
64+
}
65+
66+
/**
67+
* Get the vegetables.
68+
* @return {Array<string>} The vegetables.
69+
*/
70+
getVegetables() {
71+
return this.vegetables_;
72+
}
73+
}

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ module.exports = {
109109
preferredTypes: {
110110
'[]': 'Array<>',
111111
'.<>': '<>',
112+
'object': 'Object',
112113
},
113114
tagNamePreference: {
114115
'returns': 'return',

0 commit comments

Comments
 (0)