Skip to content
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

BemCell.create method #13

Merged
merged 3 commits into from
Feb 1, 2017
Merged

BemCell.create method #13

merged 3 commits into from
Feb 1, 2017

Conversation

qfox
Copy link
Contributor

@qfox qfox commented Jan 26, 2017

@@ -191,6 +192,40 @@ BemCell.isBemCell(cell); // true
BemCell.isBemCell({}); // false
```

### #create(object)
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

Creates BemCell instance by the any object representation.

Helper for laziness.
Copy link
Member

Choose a reason for hiding this comment

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

)))
Может тогда lazybones?

});

test('should create BemCell for block from obj', t => {
const data = { block: 'b', elem: 'e' };
Copy link
Member

Choose a reason for hiding this comment

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

зачем тут элемент? Да и кажется переменная не требуется (как в тесте ниже)

});

test('should create cell with tech', t => {
const cell = BemCell.create({ block: 'block', tech: 'css' });
Copy link
Member

Choose a reason for hiding this comment

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

надо еще добавить тест про BemCell.create({ entity, tech, layer })

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

README.md Outdated
@@ -191,6 +192,40 @@ BemCell.isBemCell(cell); // true
BemCell.isBemCell({}); // false
```

### #create(object)

Creates BemCell instance by the any object representation.
Copy link
Member

Choose a reason for hiding this comment

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

without the

index.js Outdated
@@ -211,4 +211,42 @@ module.exports = class BemCell {
static isBemCell(cell) {
return cell && this.name === cell.constructor.name;
}

/**
* Creates BemCell instance by the any object representation.
Copy link
Member

Choose a reason for hiding this comment

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

the

* @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
Member

Choose a reason for hiding this comment

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

optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, it's not if obj.mod is an object

Copy link
Member

Choose a reason for hiding this comment

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

ок

index.js Outdated
* // BemCell { block: 'my-button', mod: { name: 'theme', val: 'red' }, tech: 'css' }
*/
static create(obj) {
if (BemCell.isBemCell(obj)) {
Copy link
Member

Choose a reason for hiding this comment

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

what s the purpose ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To prevent creating BemCells from BemCells

Copy link
Member

@tadatuta tadatuta left a comment

Choose a reason for hiding this comment

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

👍

@qfox qfox merged commit 4b4509f into master Feb 1, 2017
@qfox qfox deleted the qfox.feat-create branch February 1, 2017 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants