recase icon indicating copy to clipboard operation
recase copied to clipboard

[opinionated] use Unicode Consortium file to generate guards.

Open am-kantox opened this issue 6 years ago • 2 comments

This is a very opinionated approach to eliminate regular expressions at all.

Basically, I have the implementation partially stolen from Elixir core. It parses the Consortium Unicode spec files to produce is_lowercase/1 and is_uppercase/1 guards alongside with casing/1 function returning :upper | :lower | :not_a_letter.

Due to the parsing/clause generation stage, it compiles ≈20secs, but I consider it’s affordable because normally it happens only once per project/environment. Thanks to generated guards, the Recase methods work faster than the generic clause with ~r/\p{Ll}\p{Lu}/ as we had in the previous version.

am-kantox avatar Feb 15 '19 12:02 am-kantox

Coverage Status

Coverage decreased (-0.7%) to 95.238% when pulling b1db461767e782974c0e78e96c69cb97e1d216a6 on am-kantox:feature/guards-for-upper-lower into aea2153c991c3f27fedfbc48107fda35e835d959 on sobolevn:master.

coveralls avatar Feb 15 '19 13:02 coveralls

the Recase methods work faster

How much faster?

sobolevn avatar Feb 18 '19 07:02 sobolevn