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

Commit a25976a

Browse files
committed
feat: add toJSON method for good stringify
1 parent 2eb502a commit a25976a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ module.exports = class BemEntityName {
240240
return `BemEntityName ${stringRepresentation}`;
241241
}
242242

243+
/**
244+
* Return raw data for `JSON.stringify()`.
245+
*
246+
* @returns {{block: string, elem: ?string, mod: ?{name: string, val: *}}}
247+
*/
248+
toJSON() {
249+
return this._data;
250+
}
251+
243252
/**
244253
* Determines whether specified entity is the deepEqual entity.
245254
*

0 commit comments

Comments
 (0)