-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Return default value if path is invalid #86
Return default value if path is invalid #86
Conversation
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
Test, not assertion. |
test.js
Outdated
@@ -215,5 +215,5 @@ test('prevent setting/getting `__proto__`', t => { | |||
}); | |||
|
|||
test('return default value if path is invalid', t => { | |||
t.is(dotProp.get({}, '__proto__', '🦄'), '🦄'); | |||
t.is(dotProp.get({}, 'nonexistent', '🦄'), '🦄'); |
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.
The path is only "invalid" if a disallowed property is passed. Testing for a legal property is already tested for.
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.
Is there any other non-legal value we could use that is not __proto__
?
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.
Lines 5 to 7 in 09adad9
'__proto__', | |
'prototype', | |
'constructor' |
This is the last untested part of the code (#70)