Skip to content
Ryan Sukale edited this page Jun 2, 2018 · 2 revisions

Welcome to the batarang wiki!

Legacy functions

These functions are still part of the codebase, but you are probably not going to use them because

  • Other more well known libraries already have an implementation
  • The Function interface/arguments are not the ones that are commonly encountered in real life scenarios
buildUrl(template, options = {})

Constructs a url from a template string. Optionally pass path and query params as objects to be included in the url. You probably want to use * createUrl which supports the commonly used sytnax for defining a url template string. This function is kept for legacy reasons in the unlikely event that your app uses the curly braces syntax.

var path = {id: 1, team_id: 2};
var query = {page: 1, sort: 'name'};
var basePath = 'https://api.com/users/{id}/teams/{team_id}';

buildUrl(basePath, {path, query});

// Output
'https://api.com/users/1/teams/2?page=1&sort=name'
Clone this wiki locally