-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add strict-mode proxy wrapper #44
Conversation
lib/strictProxy.js
Outdated
// if (name === 'nodeType') return undefined | ||
|
||
const val = envObj[name] | ||
if (val === undefined) { |
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.
Use hasOwnProperty
instead?
lib/strictProxy.js
Outdated
|
||
const val = envObj[name] | ||
if (val === undefined) { | ||
throw new Error(`Environment var not found: ${name}`) |
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.
Add [envalid]
prefix here as well, to be consistent
@SimenB Great feedback, thanks! Last commit should address both points |
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.
LGTM!
lib/strictProxy.js
Outdated
// if (name === 'nodeType') return undefined | ||
|
||
const varExists = envObj.hasOwnProperty(name) | ||
if (!varExists) { |
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.
varExists
can be inlined
lib/strictProxy.js
Outdated
const varExists = envObj.hasOwnProperty(name) | ||
if (!varExists) { | ||
throw new Error(`[envalid] Environment var not found: ${name}`) | ||
} else { |
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.
Unneeded else
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.
oh yeah, good point :)
Thanks! |
@af could you do a publish? (I guess it's a major unless it's moved away from |
@af now that those are closed, anything else you want to get done before release? |
@SimenB just your prettier PR now I guess :) |
Woo |
@SimenB 4.0.0 is live! Thanks for all your help :) |
Awesome! Looking forward to Monday and deleting some code 🙂 |
\o/ |
Fixes #43. @SimenB could you double check this? You have push access now so feel free to merge it too if it looks good :)