Closed brikis98 closed 7 years ago
@josh-padnick This is ready for review.
It doesn't even have a method to round numbers!! I found some open source implementations, but most were broken and incomplete, so I implemented my own with a thorough suite of tests.
That is crazy. I had to google it myself to satisfy my incredulity!
This code looks excellent. Nicely done as usual!
This PR adds a bunch of handy string and math helpers to boilerplate, such as
dasherize
,snakeCase
, andround
. This allows us to use a single value entered by a user in many different ways. For example, if aboilerplate.yml
file defines a variable calledcompanyName
, and the user enters the name “Acme Co”, with these helpers, it’s now easy to generate a variety of different types of valid code with that text, such as:{{ .companyName | camelCase }}
=> “AcmeCo”{{ .companyName | snakeCase }}
=> “acme_co”{{ .companyName | dasherize }}
=> “acme-co”BTW, this took quite a bit longer than expected because Go does not have many of these basic string and math manipulation functions built in. It doesn't even have a method to round numbers!! I found some open source implementations, but most were broken and incomplete, so I implemented my own with a thorough suite of tests.