bem-sdk-archive / bem-decl

:capital_abcd: Manage declaration of BEM entities. DEPRECATED →
https://github.com/bem/bem-sdk/tree/master/packages/decl
Other
11 stars 3 forks source link

Move to BemCell.create and BemEntityName.create #113

Open skad0 opened 7 years ago

skad0 commented 7 years ago

Now we have deprecation messages when we use a constructor for BemCell and provide to it modName and modVal fields

qfox commented 7 years ago

We should not use .create here ;-)

skad0 commented 7 years ago

Ok, i understand that .create can't guarantee correct interpretation, but is current constructor ok? Is it convenient to pass every time as

const ob = {};
ob.block = entity.modName;
if (entity.modName) {
  ob.mod = {};
  ob.mod.name = entity.modName;
  ob.mod.val = entity.modVal;
}
const lala = new BemEntityName({ entity: ob, tech: entity.tech });

or smth like that?

qfox commented 7 years ago
new BemCell({
  entity: new BemEntityName({
    block: entity.block,
    elem: entity.elem,
    mod: entity.modName
      ? { name: entity.modName, val: enrity.modVal }
      : undefuned
  }),
  tech: entity.tech
})

Like that?

skad0 commented 7 years ago

looks ugly