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

BREAKING: simplify construct and add create method #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

qfox
Copy link
Contributor

@qfox qfox commented Jan 26, 2017

Copy link
Member

@blond blond left a 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему стали обязательными полями?

Copy link
Contributor Author

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 => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно ещё тестов:

  1. mod: { name, val } + modVal + val
  2. и mod: { name, val } + val

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doneсыпал

index.js Outdated
* @example
* const BemEntityName = require('@bem/entity-name');
*
* BemEntityName.create('my-button_theme_red');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

рядом надо писать ахтунг-комментарий, что это id, а не naming

Copy link
Contributor Author

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. Написал в описание параметра

@qfox
Copy link
Contributor Author

qfox commented Jan 26, 2017

Досыпал документации

Copy link
Member

@blond blond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мелкие замечания по документации

README.md Outdated
**Example:**

```js
// Boolean modifier of a block
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему удалил этот пример?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я его перенес вниз же

README.md Outdated
@@ -255,6 +222,57 @@ name.valueOf();

Returns object for `JSON.stringify()` purposes.

### #isBemEntityName(entityName)
Copy link
Member

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.
Copy link
Member

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' } }
Copy link
Member

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' } }

@qfox qfox force-pushed the qfox.rework-majoritarity branch 7 times, most recently from f36fe69 to f52528a Compare January 26, 2017 21:14
README.md Outdated
@@ -75,6 +75,8 @@ new BemEntityName({
});
```

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`.
Copy link

@birhoff birhoff Feb 2, 2017

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
Copy link

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.
Copy link

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.
Copy link

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' } }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here mate

// ➜

index.js Outdated
if (mod || obj.modName) {
const isString = typeof mod === 'string';
const modName = (isString ? mod : mod && mod.name) || obj.modName;
const modObj = !isString && mod || obj;
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants