lib/utils.js
function interpolate(str, context) {
  const opts = { ...context.options };

  let val = opts.apiurl + str.replace(/:([\w_]+)/g, (m, key) => {
    opts.params = union(opts.params, key);
    let val = get(opts, key);
    if (val !== void 0) {
      return val;
    }
    return key;
  });

  if (opts.method.toLowerCase() === 'get' && opts.paged !== false) {
    const obj = url.parse(val);
    const query = obj.query ? qs.parse(obj.query) : {};
    const noquery = omit(obj, ['query', 'search']);
    noquery.query = noquery.search = qs.stringify(Object.assign({ per_page: 100 }, opts.query, query));
    val = url.format(noquery);
  }

  val += /\?/.test(val) ? '&' : '?';
  val += (new Date()).getTime();
  return val;
}
function interpolate(str, context) {
  const opts = { ...context.options };

  let val = opts.apiurl + str.replace(/:([\w_]+)/g, (m, key) => {
    opts.params = union(opts.params, key);
    let val = get(opts, key);
    if (val !== void 0) {
      return val;
    }
    return key;
  });

  if (opts.method.toLowerCase() === 'get' && opts.paged !== false) {
    const obj = url.parse(val);
    const query = obj.query ? qs.parse(obj.query) : {};
    const noquery = omit(obj, ['query', 'search']);
    noquery.query = noquery.search = qs.stringify(Object.assign({ per_page: 100 }, opts.query, query));
    val = url.format(noquery);
  }

  val += /\?/.test(val) ? '&' : '?';
  val += (new Date()).getTime();
  return val;
}
function interpolate ( str , context ) { const opts = { ... context . options } ; let val = opts . apiurl + str . replace ( / :([\w_]+) / g , ( m , key ) => { opts . params = union ( opts . params , key ) ; let val = get ( opts , key ) ; if ( val !== void 0 ) { return val ; } return key ; } ) ; if ( opts . method . toLowerCase ( ) === 'get' && opts . paged !== false ) { const obj = url . parse ( val ) ; const query = obj . query ? qs . parse ( obj . query ) : { } ; const noquery = omit ( obj , [ 'query' , 'search' ] ) ; noquery . query = noquery . search = qs . stringify ( Object . assign ( { per_page : 100 } , opts . query , query ) ) ; val = url . format ( noquery ) ; } val += / \? / . test ( val ) ? '&' : '?' ; val += ( new Date ( ) ) . getTime ( ) ; return val ; }
Create request URL by replacing params with actual values.
Create request URL by replacing params with actual values .