Skip to content
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

do not throw if value is null #12

Merged
merged 1 commit into from
May 19, 2016
Merged

do not throw if value is null #12

merged 1 commit into from
May 19, 2016

Conversation

stevemao
Copy link
Collaborator

@stevemao stevemao commented Dec 4, 2015

Fixes #11.

@sindresorhus
Copy link
Owner

Sorry, totally forgot about this one... I've changed my mind, I no longer think it makes sense to throw on accessor. Could you fix the merge conflict and only handle the other cases?

@sindresorhus
Copy link
Owner

ping @stevemao

@stevemao
Copy link
Collaborator Author

Hm... I was waiting for #17 to be merged first... Since I think this one is a bit tricker... I'll work on this if you think its better :)

@stevemao
Copy link
Collaborator Author

stevemao commented Apr 2, 2016

What do you think @SamVerschueren?

@SamVerschueren
Copy link
Contributor

Sorry, think I got lost somewhere in the conversation :). Where do you want my opinion on? To merge #17 first and after that this PR?

@stevemao stevemao changed the title do not throw no matter what do not throw if value is null Apr 3, 2016
@stevemao
Copy link
Collaborator Author

stevemao commented Apr 3, 2016

They all need to be merged. Just need +1s on these PRs

@@ -11,7 +11,11 @@ module.exports.get = function (obj, path) {
for (var i = 0; i < pathArr.length; i++) {
obj = obj[pathArr[i]];

if (obj === undefined) {
if (obj === undefined || obj === null) {
if (i !== pathArr.length - 1) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment on why this is here? I'm a bit unsure what it's doing.

@stevemao
Copy link
Collaborator Author

@sindresorhus I have added some comments.

@SamVerschueren
Copy link
Contributor

LGTM

@stevemao
Copy link
Collaborator Author

Sorry guys... I screwed up with git. Can you please re-push the latest commits to master branch? Or is there a way for me to restore them (I don't have those commits in my local repo)? Sorry!!

@sindresorhus
Copy link
Owner

No worries. Fixed. Btw, you can always use git reflog to undo stuff.

@sindresorhus sindresorhus merged commit 532278b into master May 19, 2016
@sindresorhus sindresorhus deleted the no-throw branch May 19, 2016 18:08
@sindresorhus
Copy link
Owner

Thanks @stevemao. Glad we could finally get this merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants