Closed YoannMa closed 4 years ago
I sometime deal with environment variables storing an array of string that I want to split. I currently do that outside of confidence.
confidence
I thought of having a way to declare it like :
new Confidence.Store({ foo : { bar: { $env : 'MY_ENV', $coerce : 'array', $splitToken : ',', $default : [] }, } })
Or would it be better to keep this out of Confidence ? As it can introduce some weird edge case like wanting to coerce to an array of number. It could also lead to more feature like parsing JSON, etc...
I can send a PR to implement the feature.
you're most welcome to submit a PR
@YoannMa, and while you are at it, would you mind adding a few more data types? like boolean and possibly an object?
boolean
object
I sometime deal with environment variables storing an array of string that I want to split. I currently do that outside of
confidence
.I thought of having a way to declare it like :
Or would it be better to keep this out of Confidence ? As it can introduce some weird edge case like wanting to coerce to an array of number. It could also lead to more feature like parsing JSON, etc...
I can send a PR to implement the feature.