vue-bem-cn icon indicating copy to clipboard operation
vue-bem-cn copied to clipboard

Feature/improvements

Open patric-eberle opened this issue 7 years ago • 3 comments
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. val can not be null anymore if val && typeof val === 'Object' where true already.
  • src/vue-plugin.js
    • Uses now external fallback config.
    • Reuse of isString method.
  • The tests had to be adjusted so they always deliver the now needed configuration.

I also tested this with our current project.

patric-eberle avatar Sep 30 '18 20:09 patric-eberle

Nice improvements, Patric! Thank you. I will try to see this PR in more detail in the near time.

c01nd01r avatar Oct 01 '18 10:10 c01nd01r

Hmmm... forgot to add the hyphenate to the block definition. Guess there is no test for this ;) Will have to fix that.

patric-eberle avatar Oct 08 '18 06:10 patric-eberle

I added the hyphenate conversion for the block now and extended the tests.

patric-eberle avatar Oct 08 '18 18:10 patric-eberle