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

BREAKING: simplify construct and add create method#70

Open
qfox wants to merge 2 commits into
masterfrom
qfox.rework-majoritarity
Open

BREAKING: simplify construct and add create method#70
qfox wants to merge 2 commits into
masterfrom
qfox.rework-majoritarity

Conversation

@qfox

@qfox qfox commented Jan 26, 2017

Copy link
Copy Markdown
Contributor

@blond blond left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

надо обновить документацию

Comment thread 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
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 всё еще нет. Косяк

Comment thread test/create.test.js
t.is(entity.mod.name, 'mod1');
});

test('should use `mod.val` field instead of `modVal`', t => {

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

doneсыпал

Comment thread index.js
* @example
* const BemEntityName = require('@bem/entity-name');
*
* BemEntityName.create('my-button_theme_red');

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

qfox commented Jan 26, 2017

Copy link
Copy Markdown
Contributor Author

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

@blond blond left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Comment thread README.md
**Example:**

```js
// Boolean modifier of a block

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Comment thread README.md

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

### #isBemEntityName(entityName)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Статичные методы сгруппировал?

Comment thread README.md Outdated

Helper for laziness.

**Important:** Only generated by id property strings are allowed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Чот ощущуние, что можно передать только строку.

Comment thread 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
Copy Markdown
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
Comment thread 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`.

@birhoff birhoff Feb 2, 2017

Copy link
Copy Markdown

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? =)

Comment thread README.md Outdated
const entityName = new BemEntityName({ block: 'input' });

BemEntityName.isBemEntityName(entityName); // true
BemEntityName.isBemEntityName({}); // false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Arrows // → true

Comment thread 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
Copy Markdown

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

Comment thread 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
Copy Markdown

Choose a reason for hiding this comment

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

required

Comment thread 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
Copy Markdown

Choose a reason for hiding this comment

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

Here mate

// ➜

Comment thread index.js
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
Copy Markdown

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.

@qfox qfox force-pushed the qfox.rework-majoritarity branch from f52528a to 7d116b2 Compare February 2, 2017 23:06
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