Closed hugovk closed 2 years ago
Hello you can reuse a string libary to do most common operations:
https://www.npmjs.com/package/string https://www.npmjs.com/package/voca
Here is a sample implementation using voca.js, I just merge the modifier object with the voca object to get all the voca functions for free to use in the grammar syntax of tracery. https://github.com/mycaule/epures/tree/master/modifiers
Thanks for the tip, that's useful for using it as a JS library!
My main reason for opening this was to be able to use it in @v21's excellent Cheap Bots, Done Quick! where end users can only enter the Tracery grammar.
There's already
capitalize
andcapitalizeAll
modifiers which produce output like "Black unicorns" and "Black Unicorns" respectively.How about
upper
andlower
(oruppercase
/lowercase
or something) to produce "BLACK UNICORNS" and "black unicorns"?