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

Removed deprecated getters from bem-entity-name package #5

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

Conversation

shkarupa-alex
Copy link

When running npm test there is deprecation warning in output:

Wed, 28 Jun 2017 11:43:06 GMT @bem/entity-name deprecated modName is kept just for compatibility and can be dropped in the future. Use mod.name instead in BemEntityName { block: 'block' } at at node_modules/@bem/entity-name/lib/entity-name.js:110:9

This patch removes it.

@qfox
Copy link
Contributor

qfox commented Jun 29, 2017

It's a long story, but it's incorrect, we can't drop support of old format in minor ({block, modName, modVal}).

Need something like this:

-    const modName = (typeof modObj === 'string' ? modObj : modObj && modObj.name) || entity.modName;
+    const modName = (typeof modObj === 'string' ? modObj : modObj && modObj.name) ||
+         entity.hasOwnProperty('modName') && entity.modName;

     if (modName) {
         const hasModVal = modObj && modObj.hasOwnProperty('val') || entity.hasOwnProperty('modVal');
-        const modVal = modObj && modObj.val || entity.modVal;
+        const modVal = modObj && modObj.val || entity.hasOwnProperty('modVal') && entity.modVal;

@shkarupa-alex
Copy link
Author

Pull request updated to restore backward compatibility

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.

2 participants