How to use the urijs/src/URITemplate function in urijs

To help you get started, we’ve selected a few urijs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stellar / js-stellar-sdk / src / call_builder.ts View on Github external
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);
    };
  }
github Mittal-Analytics / Screener.in / app / company / ratios.jsx View on Github external
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>;
}
github shoutem / redux-io / src / resources / resolver.js View on Github external
export function buildEndpoint(endpoint, params = {}, options = {}) {
  const isEndpointResolved = options[RESOLVED_ENDPOINT];
  if (isEndpointResolved) {
    return endpoint;
  }

  return new UriTemplate(endpoint).expand(params);
}
github Mittal-Analytics / Screener.in / app / company / ratios.jsx View on Github external
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>;