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

Use URL.searchParams #10

Open
wagenaartje opened this issue Jul 29, 2017 · 1 comment
Open

Use URL.searchParams #10

wagenaartje opened this issue Jul 29, 2017 · 1 comment

Comments

@wagenaartje
Copy link
Owner

wagenaartje commented Jul 29, 2017

Once URL.searchParams has compability with more browsers, we can use this to simplify the _createURL function. At this moment, the function is supported by:

  • Chrome ^51.0
  • Firefox ^52.0
  • Node ^7.5.0

The usage is pretty simple, example:

var url = new URL('https://www.alphavantage.co/query?');
var params = {
  function: 'TIME_SERIES_INTRADAY',
  symbol: 'MSFT',
  interval: '1min',
  apikey: 'demo'  
};

Object.keys(params).forEach(key => url.searchParams.append(key, params[key]))

For Node, all you need to do is add:

var URL = require('url').URL;
@wagenaartje
Copy link
Owner Author

This will be added soon, it has compatability with all major browsers now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant