-
Notifications
You must be signed in to change notification settings - Fork 119
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 optional importUrl to Shapefile method signature #23
Conversation
can we default it to shp.js ? |
Does it not? |
if(typeof cw !== 'undefined'){ | ||
if (typeof importUrl === '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.
!importUrl
would be better or importUrl = importUrl || 'shp.js'
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 "style" of the file seemed to prefer typeof
checking over the shorter methods, but I can go either way.
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.
undefined
isn't enough, since an empty string is invalid in this case.
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.
Yah, that's definitely more defensive and not as overkill as something like typeof importUrl !== 'string' || importUrl === ''
. I'll go ahead and change it to importUrl || 'shp.js'
. I guess you just have to hope cw
isn't arbitrarily defined as well, but I'll leave that for a different pr ;p
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.
importUrl will always be a variable in scope as it's defined in the arguments, cw may or may not be a global so we need to check if anyone has explicitly set it
Add optional importUrl to Shapefile method signature
Our deployment process changes what url is exposed for scripts, so it's necessary for us to be able to change it.