-
Notifications
You must be signed in to change notification settings - Fork 5
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
Recommended approach for globally setting undefined #1
Comments
Hmmm... Seems like a lot of manual work. What if it were abstracted away using a helper function? Something like this (just spitballing here): import { undefined, setGlobal } from 'undefined-is-a-function';
setGlobal('undefined', undefined); PRs welcome. 😉 |
@crosscompile you would have to do : global.undefined = undef;
// or:
window.undefined = undef; |
Following the single-responsibility principle, we should probably create a new package on npm called |
After further investigation, I think we might have a slight issue. According to MDN, modern browsers implement Not sure if this is intended to be a helpful "feature", but we might need to explore other methods to globally set |
@maniator I was thinking the same, maybe a webpack plugin or babel transform that defines |
I present, in all it's glory, babel-plugin-undefined-is-always-a-function. |
First off, thank you for this helpful package!
Using Babel,
undefined
is scoped to the module that I import it in, but I wantundefined
to be a function for my entire site. My current approach is:If this is a common use case would you consider adding a utility method?
The text was updated successfully, but these errors were encountered: