Conversation
|
|
||
| const generateOneProp = (propType, propName) => { | ||
| const generate = options.generators[propType.type] | ||
| const generateOneProp = (propType, propName, wrapInArray=true) => { |
There was a problem hiding this comment.
wrapInArray may be better off with a different name but I was struggling to find one.
There was a problem hiding this comment.
wrapInArray might be something like asPair or more verbosely asKeyValuePair — it was always just used in the .fromPairs call. wrapInArray is describing what it's doing though, so I think it's cool. This makes me think that I might want a more robust way for the primary generateProps call to invoke this function and get the structure that it needs back. In other words, let generateProps handle massaging the data into a form that it likes — don't put that responsibility on generateOneProp. I'll take this on in my next update 👍
markalfred
left a comment
There was a problem hiding this comment.
Thank you @mcpants ! This is excellent, I have just one question about isRequired but this looks good to go. Once shipped, I'll update the readme and cut a new version. Thanks again for your contribution 🙇
|
|
||
| const generateOneProp = (propType, propName) => { | ||
| const generate = options.generators[propType.type] | ||
| const generateOneProp = (propType, propName, wrapInArray=true) => { |
There was a problem hiding this comment.
wrapInArray might be something like asPair or more verbosely asKeyValuePair — it was always just used in the .fromPairs call. wrapInArray is describing what it's doing though, so I think it's cool. This makes me think that I might want a more robust way for the primary generateProps call to invoke this function and get the structure that it needs back. In other words, let generateProps handle massaging the data into a form that it likes — don't put that responsibility on generateOneProp. I'll take this on in my next update 👍
src/main.js
Outdated
| const forceGenerateOneProp = (propType) => { | ||
| const generate = GENERATORS[propType.type] | ||
| const forceGenerateOneProp = (propType, propName) => { | ||
| const generate = GENERATORS[propType.type].bind(this, propName, !propType.isRequired) |
There was a problem hiding this comment.
What function is the isRequired argument serving here?
There was a problem hiding this comment.
This was out of novelty, I figured there might be a use to getting this information to the user. In light of the changes that you discussed in your previous comment, I am going to strip this out so that this PR has less overhead. If you decide it would be useful in the future then it can easily be added back in.
There was a problem hiding this comment.
Ahhhhh okay, makes sense. Thank you for the explanation, if we find a good usecase for it in the future I'm open to the idea 👍
|
Sorry for the delay, will get back to this asap :) |
|
|
||
| .env | ||
| dist | ||
| .DS_Store |
|
All updated! |
|
Looking excellent, thank you for the contribution @mcpants ! 🙇 |
|
🎊 |
propNameandisRequiredparams to all generator functions..DS_Storeto the gitignore file.Closes #20