Skip to content

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