-
Notifications
You must be signed in to change notification settings - Fork 50
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
added insert function #4
Conversation
at = ~~at; | ||
return changeImmutable(obj, path, function(clonedObj, finalPath) { | ||
var arr = clonedObj[finalPath]; | ||
if (!isArray(arr)) |
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.
We should force arr
to be an array only if it's not set (NULL or undefined), we should throw an error instead if arr
is set and it's not an Array, this will avoid silent bugs.
Hi Dave, thanks for the PR, it looks great. |
Does this address the concerns? |
Thanks a lot for the PR, merged now |
When you have some time could you please send another PR adding something in the readme to document the new function? |
Added similar functionality to object-path for inserting at an array index.