-
Notifications
You must be signed in to change notification settings - Fork 74
Conversation
a-wart
commented
Aug 6, 2015
This assumes that keys are intended to be valid identifiers, but the existing usage supports arbitrary string keys. |
That's ok. You can use it as you want. |
ping @sokra |
* @returns {*} | ||
*/ | ||
function byString(object, stringKey) { | ||
stringKey = stringKey.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties |
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.
Either don't allow this at all or implement it correctly.
abc[def]
is not the correct syntax. abc["def"]
is the correct syntax. Also make sure that abc["def['ghi']"]
works ;).
This would be a breaking change. It's propably better to make this opt-in. Try the change the signature of the plugin to |
👍 on adding support for nested values. |
👍 from me too. I really wanna use this plugin, but it seems rather... dead and missing some key features. Should I roll my own, or is this coming back to life any time soon? :) |
@wart what about PR?
|
coming soon guys, just couple of days:) |
I feel like a kid in a candy store 😊 |
@sokra I updated PR, check it please |
object = object[key]; | ||
} else { | ||
return; | ||
} |
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.
Too much spacing
@sokra , updated |
Thanks |
@sokra and thank you! |