-
Notifications
You must be signed in to change notification settings - Fork 3
BREAKING: simplify construct and add create method #70
base: master
Are you sure you want to change the base?
Conversation
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.
надо обновить документацию
index.js
Outdated
* @param {string} [obj.mod.name] — the modifier name of entity. | ||
* @param {string} [obj.mod.val] — the modifier value of entity. | ||
* @param {string} obj.mod.name — the modifier name of entity. | ||
* @param {string} obj.mod.val — the modifier value of entity. |
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.
Почему стали обязательными полями?
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.
Если mod передан, то name обязателен. val всё еще нет. Косяк
t.is(entity.mod.name, 'mod1'); | ||
}); | ||
|
||
test('should use `mod.val` field instead of `modVal`', t => { |
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.
Можно ещё тестов:
mod: { name, val }
+modVal
+val
- и
mod: { name, val }
+val
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.
doneсыпал
* @example | ||
* const BemEntityName = require('@bem/entity-name'); | ||
* | ||
* BemEntityName.create('my-button_theme_red'); |
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, а не naming
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.
Supported only strings generated with id property. Написал в описание параметра
Досыпал документации |
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.
мелкие замечания по документации
**Example:** | ||
|
||
```js | ||
// Boolean modifier of a block |
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.
Почему удалил этот пример?
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 object for `JSON.stringify()` purposes. | ||
|
||
### #isBemEntityName(entityName) |
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.
Статичные методы сгруппировал?
README.md
Outdated
|
||
Helper for laziness. | ||
|
||
**Important:** Only generated by id property strings are allowed. |
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.
Чот ощущуние, что можно передать только строку.
README.md
Outdated
BemEntityName.create('my-button_theme_red'); | ||
BemEntityName.create({ block: 'my-button', mod: 'theme', val: 'red' }); | ||
BemEntityName.create({ block: 'my-button', modName: 'theme', modVal: 'red' }); | ||
// BemEntityName { block: 'my-button', mod: { name: 'theme', val: 'red' } } |
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 { block: 'my-button', mod: { name: 'theme', val: 'red' } }
f36fe69
to
f52528a
Compare
README.md
Outdated
|
||
To describe the simple modifier, field `mod.val` must be specified as `true`. | ||
|
||
To describe the simple modifier field `mod.val` must be specified as `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.
Do you think that people do not understand at first time? =)
README.md
Outdated
const entityName = new BemEntityName({ block: 'input' }); | ||
|
||
BemEntityName.isBemEntityName(entityName); // true | ||
BemEntityName.isBemEntityName({}); // false |
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.
Arrows // → true
README.md
Outdated
`mod.name` | `string` | The modifier name of entity. | ||
`mod.val` | `*` | The modifier value of entity. | ||
`modName` | `string` | The modifier name of entity. | ||
`modVal` | `*` | The modifier value of entity. |
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.
modVal can be only String|True|undefined
index.js
Outdated
* @param {string} obj.block — the block name of entity. | ||
* @param {string} [obj.elem] — the element name of entity. | ||
* @param {object|string} [obj.mod] — the modifier of entity. | ||
* @param {string} [obj.mod.name] — the modifier name of entity. |
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.
required
index.js
Outdated
* BemEntityName.create('my-button_theme_red'); | ||
* BemEntityName.create({ block: 'my-button', mod: 'theme', val: 'red' }); | ||
* BemEntityName.create({ block: 'my-button', modName: 'theme', modVal: 'red' }); | ||
* // BemEntityName { block: 'my-button', mod: { name: 'theme', val: 'red' } } |
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.
Here mate
// ➜
if (mod || obj.modName) { | ||
const isString = typeof mod === 'string'; | ||
const modName = (isString ? mod : mod && mod.name) || obj.modName; | ||
const modObj = !isString && mod || obj; |
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.
Why is initial obj? There is no description about it. I think empty Object is better here.
f52528a
to
7d116b2
Compare
cc @tadatuta @blond @Yeti-or