Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async (opts: any = {}) => {
let uri;
if (link.templated) {
const template = URITemplate(link.href);
uri = URI(template.expand(opts) as any); // TODO: fix upstream types.
} else {
uri = URI(link.href);
}
const r = await this._sendNormalRequest(uri);
return this._parseResponse(r);
};
}
function getExchanges(company) {
var bse_link = '',
nse_link = '';
if(company.bse_code !== "") {
var slug = toSlug(company.name);
bse_link = new URITemplate(
'http://www.bseindia.com/stock-share-price{/slugs*}/'
);
bse_link = bse_link.expand({slugs: [slug, slug, company.bse_code]});
bse_link = <a href="{bse_link}">BSE</a>;
}
if(company.nse_code !== "") {
nse_link = new URITemplate(
'http://nseindia.com/live_market/dynaContent/live_watch/' +
'get_quote/GetQuote.jsp{?params*}'
);
nse_link = nse_link.expand({params: {symbol: company.nse_code}});
nse_link = <a href="{nse_link}">NSE</a>;
if(bse_link !== '')
nse_link = <span> and {nse_link}</span>;
}
return <span>Listed on {bse_link}{nse_link}</span>;
}
export function buildEndpoint(endpoint, params = {}, options = {}) {
const isEndpointResolved = options[RESOLVED_ENDPOINT];
if (isEndpointResolved) {
return endpoint;
}
return new UriTemplate(endpoint).expand(params);
}
function getExchanges(company) {
var bse_link = '',
nse_link = '';
if(company.bse_code !== "") {
var slug = toSlug(company.name);
bse_link = new URITemplate(
'http://www.bseindia.com/stock-share-price{/slugs*}/'
);
bse_link = bse_link.expand({slugs: [slug, slug, company.bse_code]});
bse_link = <a href="{bse_link}">BSE</a>;
}
if(company.nse_code !== "") {
nse_link = new URITemplate(
'http://nseindia.com/live_market/dynaContent/live_watch/' +
'get_quote/GetQuote.jsp{?params*}'
);
nse_link = nse_link.expand({params: {symbol: company.nse_code}});
nse_link = <a href="{nse_link}">NSE</a>;
if(bse_link !== '')
nse_link = <span> and {nse_link}</span>;
}
return <span>Listed on {bse_link}{nse_link}</span>;