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 +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ buttonTextBoldName.belongsTo(buttonName); // false
270
270
271
271
### valueOf()
272
272
273
- Returns object representing the entity name.
273
+ Returns normalized object representing the entity name.
274
274
275
275
``` js
276
276
const BemEntityName = require (' @bem/entity-name' );
@@ -283,7 +283,15 @@ name.valueOf();
283
283
284
284
### toJSON()
285
285
286
- Returns object for ` JSON.stringify() ` purposes.
286
+ Returns raw data for ` JSON.stringify() ` purposes.
287
+
288
+ ``` js
289
+ const BemEntityName = require (' @bem/entity-name' );
290
+
291
+ const name = new BemEntityName ({ block: ' input' , mod: ' available' });
292
+
293
+ JSON .stringify (name); // {"block":"input","mod":{"name":"available","val":true}}
294
+ ```
287
295
288
296
### toString()
289
297
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ class BemEntityName {
284
284
}
285
285
286
286
/**
287
- * Returns object representing the entity name. Is needed for debug in Node.js .
287
+ * Returns normalized object representing the entity name.
288
288
*
289
289
* In some browsers `console.log()` calls `valueOf()` on each argument.
290
290
* This method will be called to get custom string representation of the object.
@@ -305,7 +305,14 @@ class BemEntityName {
305
305
valueOf ( ) { return this . _data ; }
306
306
307
307
/**
308
- * Return raw data for `JSON.stringify()`.
308
+ * Returns raw data for `JSON.stringify()` purposes.
309
+ *
310
+ * @example
311
+ * const BemEntityName = require('@bem/entity-name');
312
+ *
313
+ * const name = new BemEntityName({ block: 'input', mod: 'available' });
314
+ *
315
+ * JSON.stringify(name); // {"block":"input","mod":{"name":"available","val":true}}
309
316
*
310
317
* @returns {BemSDK.EntityName.StrictRepresentation }
311
318
*/
You can’t perform that action at this time.
0 commit comments