This repository was archived by the owner on Feb 4, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 67
67
* [ type] ( #type )
68
68
* [ isSimpleMod()] ( #issimplemod )
69
69
* [ isEqual(entityName)] ( #isequalentityname )
70
+ * [ belongsTo(entityName)] ( #belongstoentityname )
70
71
* [ toString()] ( #tostring )
71
72
* [ valueOf()] ( #valueof )
72
73
* [ toJSON()] ( #tojson )
@@ -227,6 +228,29 @@ inputName.isEqual(buttonName); // false
227
228
buttonName .isEqual (buttonName); // true
228
229
```
229
230
231
+ ### belongsTo(entityName)
232
+
233
+ Parameter | Type | Description
234
+ -------------|-----------------|-----------------------
235
+ ` entityName ` | ` BemEntityName ` | The entity to compare.
236
+
237
+ Determines whether specified entity belongs to this.
238
+
239
+ ``` js
240
+ const BemEntityName = require (' @bem/entity-name' );
241
+
242
+ const buttonName = new BemEntityName ({ block: ' button' });
243
+ const buttonTextName = new BemEntityName ({ block: ' button' , elem: ' text' });
244
+ const buttonTextBoldName = new BemEntityName (
245
+ { block: ' button' , elem: ' text' , mod: { name: ' bold' , val: true } }
246
+ );
247
+
248
+ buttonTextName .belongsTo (buttonName); // true
249
+ buttonName .belongsTo (buttonTextName); // false
250
+ buttonTextBoldName .belongsTo (buttonTextName); // true
251
+ buttonTextBoldName .belongsTo (buttonName); // false
252
+ ```
253
+
230
254
### toString()
231
255
232
256
Returns string representing the entity name.
Original file line number Diff line number Diff line change @@ -318,9 +318,14 @@ class BemEntityName {
318
318
*
319
319
* const buttonName = new BemEntityName({ block: 'button' });
320
320
* const buttonTextName = new BemEntityName({ block: 'button', elem: 'text' });
321
+ * const buttonTextBoldName = new BemEntityName(
322
+ * { block: 'button', elem: 'text', mod: { name: 'bold', val: true } }
323
+ * );
321
324
*
322
325
* buttonTextName.belongsTo(buttonName); // true
323
326
* buttonName.belongsTo(buttonTextName); // false
327
+ * buttonTextBoldName.belongsTo(buttonTextName); // true
328
+ * buttonTextBoldName.belongsTo(buttonName); // false
324
329
*
325
330
* @param {BemEntityName } entityName - the entity to compare.
326
331
*
You can’t perform that action at this time.
0 commit comments