-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adds utility service and access to commander #251
Conversation
Nx Cloud ReportCI is running for commit 4d93adb. 📂 Click to track the progress, see the status, the terminal output, and the build insights. Sent with 💌 from NxCloud. |
|
@micalevisk @smolinari would y'all mind taking a look at this and checking my logic along with what the addition is? Thanks guys |
I'll try this feat out next saturday. The logic seems fine. I think would be cool to add in-code docs like /**
* A helper method to turn a string (case insensitive) into a boolean based on true or false values.
*
* Any string that matches one of the following values is considered a `true` input:
* - `yes`
* - `y`
* - `true`
* - `t`
* - `1`
*
* Any string that matches one of the following values is considered a `false` input:
* - `no`
* - `n`
* - `false`
* - `f`
* - `0`
*
* @param val
* @throws {Error} If `val` is not a _true_ nor _false_ expression
*/
parseBoolean(val: string): boolean { and /**
* A Simple wrapper around `Number.parseInt()`
* @param val
* @param radix
*/
parseInt(val: string, radix = 10): number {
/**
* A simple wrapper around `Number.parseFloat()`
* @param val
*/
parseFloat(val: string): number { to improve DX a bit. Although this is redundant as they're documented already on the docs site. |
Yeah, I think the doc string would definitely be helpful for in IDE docs. It's just that none of the other methods have that, so adding it might feel out of place. |
From what I can see, looks good. 👍 Asking me to check your work is like master Po asking Grasshopper if his Kung Fu is good. LOL! 😁 Scott |
@jmcdo29 how do we import this new service? it isn't listed below |
Whoops, missed that. See this is why I have someone double check me |
81da92a
to
4d93adb
Compare
How do we use this? |
There is a new
CliUtilityService
and@InjectCommnder()
decoraotrthat allows for direct access to the commander instnace. The utility service
has methods like
parseBoolean
,parseInt
, andparseFloat
. Thenumber parsing methods are just simple wrappers around
Number.parse*()
,but the boolean parsing method handles true being
yes
,y
,1
,true
, andt
and false beingno
,n
,false
,f
, and0
.