Skip to content
This repository was archived by the owner on Feb 4, 2018. It is now read-only.

Commit e7f862d

Browse files
authored
Merge pull request #75 from bem-sdk/qfox.fix-jsdoc
docs: trivial sync between jsdoc and code
2 parents 33ce653 + 81b57b0 commit e7f862d

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

index.js

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ module.exports = class BemEntityName {
2222
* @param {object} obj — representation of entity name.
2323
* @param {string} obj.block — the block name of entity.
2424
* @param {string} [obj.elem] — the element name of entity.
25-
* @param {object} [obj.mod] — the modifier of entity.
26-
* @param {string} [obj.mod.name] — the modifier name of entity.
27-
* @param {string} [obj.mod.val] — the modifier value of entity.
25+
* @param {object} [obj.mod] — the modifier of entity.
26+
* @param {string} obj.mod.name — the modifier name of entity.
27+
* @param {string} [obj.mod.val] — the modifier value of entity.
28+
* @param {string} [obj.modName] — the modifier name of entity. Used if `mod.name` wasn't specified.
29+
* @param {string} [obj.modVal] — the modifier value of entity.
30+
* Used if neither `mod.val` nor `val` were not specified.
2831
*/
2932
constructor(obj) {
3033
if (!obj.block) {
@@ -75,7 +78,7 @@ module.exports = class BemEntityName {
7578
*
7679
* name.elem; // text
7780
*
78-
* @returns {string} name of entity element.
81+
* @returns {string|undefined} - name of entity element.
7982
*/
8083
get elem() { return this._data.elem; }
8184

@@ -93,7 +96,7 @@ module.exports = class BemEntityName {
9396
* modName.mod; // { name: 'disabled', val: true }
9497
* blockName.mod; // undefined
9598
*
96-
* @returns {{mod: string, val: *}} entity modifier.
99+
* @returns {{mod: string, val: (string|true)}|undefined} - entity modifier.
97100
*/
98101
get mod() { return this._data.mod; }
99102

@@ -102,8 +105,8 @@ module.exports = class BemEntityName {
102105
*
103106
* If entity is not modifier then returns `undefined`.
104107
*
105-
* @returns {string} entity modifier name.
106-
* @deprecated use `mod.name` instead.
108+
* @returns {string|undefined} - entity modifier name.
109+
* @deprecated - use `mod.name` instead.
107110
*/
108111
get modName() { return this.mod && this.mod.name; }
109112

@@ -112,8 +115,8 @@ module.exports = class BemEntityName {
112115
*
113116
* If entity is not modifier then returns `undefined`.
114117
*
115-
* @returns {string} entity modifier name.
116-
* @deprecated use `mod.val` instead.
118+
* @returns {string|undefined} - entity modifier name.
119+
* @deprecated - use `mod.val` instead.
117120
*/
118121
get modVal() { return this.mod && this.mod.val; }
119122

@@ -131,7 +134,7 @@ module.exports = class BemEntityName {
131134
*
132135
* name.id; // button_disabled
133136
*
134-
* @returns {string} id of entity.
137+
* @returns {string} - id of entity.
135138
*/
136139
get id() {
137140
if (this._id) { return this._id; }
@@ -162,7 +165,7 @@ module.exports = class BemEntityName {
162165
*
163166
* name.type; // elemMod
164167
*
165-
* @returns {string} type of entity.
168+
* @returns {string} - type of entity. One of 'block', 'elem', 'blockMod', 'elemMod'.
166169
*/
167170
get type() {
168171
if (this._type) { return this._type; }
@@ -176,6 +179,7 @@ module.exports = class BemEntityName {
176179

177180
return this._type;
178181
}
182+
179183
/**
180184
* Returns string representing the entity name.
181185
*
@@ -209,7 +213,7 @@ module.exports = class BemEntityName {
209213
*
210214
* // ➜ { block: 'button', mod: { name: 'focused', value: true } }
211215
*
212-
* @returns {{block: string, elem: ?string, mod: ?{name: ?string, val: *}}}
216+
* @returns {{block: string, elem: (string|undefined), mod: ({name: string, val: (string|true)}|undefined)}}
213217
*/
214218
valueOf() { return this._data; }
215219

@@ -228,9 +232,9 @@ module.exports = class BemEntityName {
228232
*
229233
* console.log(name); // BemEntityName { block: 'button' }
230234
*
231-
* @param {integer} depth — tells inspect how many times to recurse while formatting the object.
235+
* @param {number} depth — tells inspect how many times to recurse while formatting the object.
232236
* @param {object} options — An optional `options` object may be passed
233-
* that alters certain aspects of the formatted string.
237+
* that alters certain aspects of the formatted string.
234238
*
235239
* @returns {string}
236240
*/
@@ -243,7 +247,8 @@ module.exports = class BemEntityName {
243247
/**
244248
* Return raw data for `JSON.stringify()`.
245249
*
246-
* @returns {{block: string, elem: ?string, mod: ?{name: string, val: *}}}
250+
* @returns {{block: string, elem: (string|undefined),
251+
* mod: ({name: string, val: (string|true|undefined)}|undefined)}}
247252
*/
248253
toJSON() {
249254
return this._data;
@@ -254,7 +259,7 @@ module.exports = class BemEntityName {
254259
*
255260
* @param {BemEntityName} entityName - the entity to compare.
256261
*
257-
* @returns {boolean} A Boolean indicating whether or not specified entity is the deepEqual entity.
262+
* @returns {boolean} - A Boolean indicating whether or not specified entity is the deepEqual entity.
258263
* @example
259264
* const BemEntityName = require('@bem/entity-name');
260265
*
@@ -294,7 +299,7 @@ module.exports = class BemEntityName {
294299
* @param {string} [obj.elem] — the element name of entity.
295300
* @param {object|string} [obj.mod] — the modifier of entity.
296301
* @param {string} [obj.val] - the modifier value of entity. Used if `obj.mod` is a string.
297-
* @param {string} [obj.mod.name] — the modifier name of entity.
302+
* @param {string} obj.mod.name — the modifier name of entity.
298303
* @param {string} [obj.mod.val] — the modifier value of entity.
299304
* @param {string} [obj.modName] — the modifier name of entity. Used if `obj.mod.name` wasn't specified.
300305
* @param {string} [obj.modVal] — the modifier value of entity.
@@ -307,7 +312,7 @@ module.exports = class BemEntityName {
307312
* BemEntityName.create('my-button_theme_red');
308313
* BemEntityName.create({ block: 'my-button', mod: 'theme', val: 'red' });
309314
* BemEntityName.create({ block: 'my-button', modName: 'theme', modVal: 'red' });
310-
* // BemEntityName { block: 'my-button', mod: { name: 'theme', val: 'red' } }
315+
* // BemEntityName { block: 'my-button', mod: { name: 'theme', val: 'red' } }
311316
*/
312317
static create(obj) {
313318
if (BemEntityName.isBemEntityName(obj)) {

0 commit comments

Comments
 (0)