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

Simplify parse and stringify methods #4

Open
Yeti-or opened this issue Jun 6, 2017 · 0 comments
Open

Simplify parse and stringify methods #4

Yeti-or opened this issue Jun 6, 2017 · 0 comments

Comments

@Yeti-or
Copy link
Member

Yeti-or commented Jun 6, 2017

original: bem/bem-sdk#181

Atm naming has shared parts of code with BemEntityName like usage of deprecated fields.
Would be better to has a tiny method for stringifying entityName with naming:

let res = e.block;
e.elem && (res += delims.elem + e.elem);
e.mod && (
  res += delims.mod.name + e.mod.name,
  e.mod.val === true || (res += delims.mod.val + e.mod.val)
);
return res;

and another tiny method for normalization old versions to the modern one as it does in BemEntityName.create: https://github.com/bem-sdk/bem-entity-name/blob/86e59d24/lib/entity-name.js#L379-L406

Perhaps we can make a separate function to let users use it with stringify as they did it before.

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

No branches or pull requests

1 participant