-
-
Notifications
You must be signed in to change notification settings - Fork 728
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
Add mixed array and object dot notation support Closes: #47 #66
Conversation
@@ -83,6 +83,10 @@ internals.parseKeys = function (key, val, options) { | |||
return; | |||
} | |||
|
|||
// Transform dot notation to bracket notation | |||
|
|||
key = key.replace(/\.(\w+)/g, '[$1]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels too strict, \w
is alphanumeric plus underscores, so it rules out plenty of valid characters. Maybe better to make it /\.([^\.\[]+)/
.
I'm also curious how big of a hit this has on performance..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the regex.
What is the best way to measure perf? A few console logs show the speed to be the same as before.
I'm trying to think of scenarios this might not work, but this is definitely the simplest solution for 90+% of use cases. I'm still undecided how flexible I want this module to be, since there's been a ton of bikeshedding and debate over what it should do and how. Part of me thinks it should support as many use cases as possible, but the other part of me realizes it borders on crazy to do that and I should just keep what it does clearly defined and move on. I'm still chewing on this, and I'll get back to it, but thanks for the effort so far! |
We bumped into this issue when dealing with a legacy .net application which has to remain unchanged. We need to being accepting form submissions using express-body-parser and would like to avoid using a custom implementation on specific routes. Thanks for the feedback. |
👍 |
Any movement on this? |
@nlf this is a 4 months old pull request. Please merge or close. |
Add mixed array and object dot notation support Closes: #47
No description provided.