63
63
* [ block] ( #block )
64
64
* [ elem] ( #elem )
65
65
* [ mod] ( #mod )
66
- * [ id] ( #id )
67
66
* [ type] ( #type )
67
+ * [ id] ( #id )
68
68
* [ isSimpleMod()] ( #issimplemod )
69
69
* [ isEqual(entityName)] ( #isequalentityname )
70
70
* [ belongsTo(entityName)] ( #belongstoentityname )
71
- * [ toString()] ( #tostring )
72
71
* [ valueOf()] ( #valueof )
73
72
* [ toJSON()] ( #tojson )
74
- * [ static isBemEntityName(entityName )] ( #static-isbementitynameentityname )
73
+ * [ toString( )] ( #tostring )
75
74
* [ static create(obj)] ( #static-createobj )
75
+ * [ static isBemEntityName(entityName)] ( #static-isbementitynameentityname )
76
76
77
77
### constructor({ block, elem, mod })
78
78
@@ -162,21 +162,6 @@ modName.mod; // { name: 'disabled', val: true }
162
162
blockName .mod ; // undefined
163
163
```
164
164
165
- ### id
166
-
167
- The id for this entity.
168
-
169
- ** Important:** should only be used to determine uniqueness of entity.
170
-
171
- If you want to get string representation in accordance with the provisions naming convention you should use [ @bem/naming ] ( https://github.com/bem-sdk/bem-naming ) package.
172
-
173
- ``` js
174
- const BemEntityName = require (' @bem/entity-name' );
175
- const name = new BemEntityName ({ block: ' button' , mod: ' disabled' });
176
-
177
- name .id ; // button_disabled
178
- ```
179
-
180
165
### type
181
166
182
167
The type for this entity.
@@ -193,6 +178,21 @@ elemName.type; // elem
193
178
modName .type ; // elemMod
194
179
```
195
180
181
+ ### id
182
+
183
+ The id for this entity.
184
+
185
+ ** Important:** should only be used to determine uniqueness of entity.
186
+
187
+ If you want to get string representation in accordance with the provisions naming convention you should use [ @bem/naming ] ( https://github.com/bem-sdk/bem-naming ) package.
188
+
189
+ ``` js
190
+ const BemEntityName = require (' @bem/entity-name' );
191
+ const name = new BemEntityName ({ block: ' button' , mod: ' disabled' });
192
+
193
+ name .id ; // button_disabled
194
+ ```
195
+
196
196
### isSimpleMod()
197
197
198
198
Determines whether modifier simple or not.
@@ -249,20 +249,6 @@ buttonTextBoldName.belongsTo(buttonTextName); // true
249
249
buttonTextBoldName .belongsTo (buttonName); // false
250
250
```
251
251
252
- ### toString()
253
-
254
- Returns string representing the entity name.
255
-
256
- ** Important:** if you want to get string representation in accordance with the provisions naming convention
257
- you should use [ @bem/naming ] ( https://github.com/bem-sdk/bem-naming ) package.
258
-
259
- ``` js
260
- const BemEntityName = require (' @bem/entity-name' );
261
- const name = new BemEntityName ({ block: ' button' , mod: ' focused' });
262
-
263
- name .toString (); // button_focused
264
- ```
265
-
266
252
### valueOf()
267
253
268
254
Returns object representing the entity name.
@@ -280,21 +266,18 @@ name.valueOf();
280
266
281
267
Returns object for ` JSON.stringify() ` purposes.
282
268
283
- ### static isBemEntityName(entityName )
269
+ ### toString( )
284
270
285
- Determines whether specified entity is an instance of BemEntityName .
271
+ Returns string representing the entity name .
286
272
287
- Parameter | Type | Description
288
- -------------|-----------------|-----------------------
289
- ` entityName ` | ` * ` | The entity to check.
273
+ ** Important:** if you want to get string representation in accordance with the provisions naming convention
274
+ you should use [ @bem/naming ] ( https://github.com/bem-sdk/bem-naming ) package.
290
275
291
276
``` js
292
277
const BemEntityName = require (' @bem/entity-name' );
278
+ const name = new BemEntityName ({ block: ' button' , mod: ' focused' });
293
279
294
- const entityName = new BemEntityName ({ block: ' input' });
295
-
296
- BemEntityName .isBemEntityName (entityName); // true
297
- BemEntityName .isBemEntityName ({ block: ' button' }); // false
280
+ name .toString (); // button_focused
298
281
```
299
282
300
283
### static create(object)
@@ -335,6 +318,23 @@ BemEntityName.create({ block: 'my-button', mod: 'focused' });
335
318
// ➜ BemEntityName { block: 'my-button', mod: { name: 'focused', val: true } }
336
319
```
337
320
321
+ ### static isBemEntityName(entityName)
322
+
323
+ Determines whether specified entity is an instance of BemEntityName.
324
+
325
+ Parameter | Type | Description
326
+ -------------|-----------------|-----------------------
327
+ ` entityName ` | ` * ` | The entity to check.
328
+
329
+ ``` js
330
+ const BemEntityName = require (' @bem/entity-name' );
331
+
332
+ const entityName = new BemEntityName ({ block: ' input' });
333
+
334
+ BemEntityName .isBemEntityName (entityName); // true
335
+ BemEntityName .isBemEntityName ({ block: ' button' }); // false
336
+ ```
337
+
338
338
TypeScript support
339
339
------------------
340
340
0 commit comments