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

Add optional importUrl to Shapefile method signature #23

Merged
merged 3 commits into from
May 14, 2015

Conversation

davidlukerice
Copy link
Contributor

Our deployment process changes what url is exposed for scripts, so it's necessary for us to be able to change it.

@calvinmetcalf
Copy link
Owner

can we default it to shp.js ?

@davidlukerice
Copy link
Contributor Author

Does it not?

if(typeof cw !== 'undefined'){
if (typeof importUrl === 'undefined') {
Copy link
Collaborator

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'

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 "style" of the file seemed to prefer typeof checking over the shorter methods, but I can go either way.

Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Owner

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

calvinmetcalf added a commit that referenced this pull request May 14, 2015
Add optional importUrl to Shapefile method signature
@calvinmetcalf calvinmetcalf merged commit 8c69a68 into calvinmetcalf:gh-pages May 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants