-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debuggability methods #10
Conversation
977212a
to
9440660
Compare
@@ -129,6 +132,93 @@ const cell = new BemCell({ | |||
cell.id; // ➜ "button__text@desktop.css" | |||
``` | |||
|
|||
### toString() | |||
|
|||
Returns string representing this cell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns a string
|
||
### valueOf() | ||
|
||
Returns object representing this cell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns an object
|
||
### toJSON() | ||
|
||
Returns object for `JSON.stringify()` purposes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns an object
and not sure about purposes
, shouldn't it be in singular?
// ➜ BemCell { entity: { block: 'input', mod: { name: 'available' } }, tech: 'css' } | ||
``` | ||
|
||
You can also convert `BemCell` object to `string`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to string
-> to a string
9440660
to
e0217ac
Compare
@tadatuta <3 ty |
e0217ac
to
637e9ff
Compare
entity: new BemEntityName({ block: 'button', mod: 'focused' }) | ||
}); | ||
|
||
cell.toString(); // button_focused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше все поля в примере показать, чтобы не путать с BemEntityName
.
|
||
cell.valueOf(); | ||
|
||
// ➜ { entity: { block: 'button', mod: { name: 'focused', value: true } } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и тут лучше все поля показать
* In some browsers `console.log()` calls `valueOf()` on each argument. | ||
* This method will be called to get custom string representation of the object. | ||
* | ||
* The representation object contains only `block`, `elem` and `mod` fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не нужно уточнить, что это про entity
поле?
entity: new BemEntityName({ block: 'block' }) | ||
}); | ||
|
||
t.truthy(typeof cell.toString() === 'string'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может ещё проверять, что id
равен toString
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А точно есть смысл? Нам же не особо важен формат
* | ||
* @returns {string} | ||
*/ | ||
toString() { return this.id; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by the way why not
path.join(this.layer || '', this.entity)
?
a29b345
to
d266974
Compare
No description provided.