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

Return default value if path is invalid #86

Merged
merged 6 commits into from Sep 8, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion test.js
Expand Up @@ -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', '🦄'), '🦄');
Copy link
Contributor Author

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.

Copy link
Owner

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__?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dot-prop/index.js

Lines 5 to 7 in 09adad9

'__proto__',
'prototype',
'constructor'

})