vue-bem-cn
vue-bem-cn copied to clipboard
Feature/improvements
trafficstars
This PR tries to reduce the amount of fallback merges and conditions. This PR should not break or extend any functionality.
- src/bem-cn/bem-names.js
- The configuration fallback was removed since it will always be available from the method caller (as long as kept inside plugin scope).
- The conditions were rearenged to reduce number of evaluations.
- src/bem-cn/index.js
- The configuration fallback was removed since it will always be available from the method caller (as long as kept inside plugin scope).
- The conditions were rearenged to reduce number of evaluations.
- src/globals.js
- The fallback config has been moved to it's own file. Initially this was because it was needed by multiple methods. In the meantime it's only purpose is to also be usable for the tests.
- src/utils.js
- Some of the conditions were removed since they are covered by others. (e.g.
valcan not benullanymore ifval && typeof val === 'Object'where true already. - src/vue-plugin.js
- Uses now external fallback config.
- Reuse of
isStringmethod.
- The tests had to be adjusted so they always deliver the now needed configuration.
I also tested this with our current project.
Nice improvements, Patric! Thank you. I will try to see this PR in more detail in the near time.
Hmmm... forgot to add the hyphenate to the block definition. Guess there is no test for this ;) Will have to fix that.
I added the hyphenate conversion for the block now and extended the tests.