How to use aurelia-path - 10 common examples

To help you get started, we’ve selected a few aurelia-path 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 SpoonX / aurelia-api / src / rest.js View on Github external
request(method: string, path: string, body?: {}, options?: {}, responseOutput?: { response: Response}): Promise {
    let requestOptions = extend(true, {headers: {}}, this.defaults || {}, options || {}, {method, body});
    let contentType    = requestOptions.headers['Content-Type'] || requestOptions.headers['content-type'];

    // if body is object, stringify to json or urlencoded depending on content-type
    if (typeof body === 'object' && body !== null && contentType) {
      requestOptions.body = (/^application\/(.+\+)?json/).test(contentType.toLowerCase())
                          ? JSON.stringify(body)
                          : buildQueryString(body);
    }

    return this.client.fetch(path, requestOptions).then((response: Response) => {
      if (response.status >= 200 && response.status < 400) {
        if (responseOutput) {
          responseOutput.response = response;
        }

        return response.json().catch(() => null);
      }

      throw response;
    });
  }
github aurelia / route-recognizer / dist / aurelia-route-recognizer.js View on Github external
} else {
        output += '/';
        output += segmentValue;
      }
    }

    if (output.charAt(0) !== '/') {
      output = '/' + output;
    }

    // remove params used in the path and add the rest to the querystring
    for (let param in consumed) {
      delete routeParams[param];
    }

    let queryString = buildQueryString(routeParams);
    output += queryString ? `?${queryString}` : '';

    return output;
  }
github Mordred / aurelia-sails-socket-client / src / socket-request-message.js View on Github external
function buildFullUrl(message) {
  let url;
  let qs;

  // Message URL starts with / - as absolute URL
  if (message.url && message.url[0] === '/') {
    url = message.url;
  } else {
    url = join(message.baseUrl, message.url);
  }

  if (message.params) {
    qs = buildQueryString(message.params);
    url = qs ? `${url}?${qs}` : url;
  }

  return url;
}
github aurelia / templating-router / dist / native-modules / route-loader.js View on Github external
TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) {
    var childContainer = router.container.createChild();

    var viewModel = void 0;
    if (config.moduleId === null) {
      viewModel = EmptyClass;
    } else if (/\.html/i.test(config.moduleId)) {
      viewModel = createDynamicClass(config.moduleId);
    } else {
      viewModel = relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId);
    }

    var instruction = {
      viewModel: viewModel,
      childContainer: childContainer,
      view: config.view || config.viewStrategy,
      router: router
    };

    childContainer.registerSingleton(RouterViewLocator);

    childContainer.getChildRouter = function () {
      var childRouter = void 0;

      childContainer.registerHandler(Router, function (c) {
        return childRouter || (childRouter = router.createChild(childContainer));
github aurelia / http-client / dist / es2015 / aurelia-http-client.js View on Github external
buildFullUrl() {
    let absoluteUrl = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
    let url = absoluteUrl.test(this.url) ? this.url : join(this.baseUrl, this.url);

    if (this.params) {
      let qs = buildQueryString(this.params, this.traditional);
      url = qs ? url + (this.url.indexOf('?') < 0 ? '?' : '&') + qs : url;
    }

    return url;
  }
};
github aurelia / http-client / src / request-message.js View on Github external
buildFullUrl(): string {
    let absoluteUrl = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
    let url = absoluteUrl.test(this.url) ? this.url : join(this.baseUrl, this.url);

    if (this.params) {
      let qs = buildQueryString(this.params);
      url = qs ? url + (this.url.indexOf('?') < 0 ? '?' : '&') + qs : url;
    }

    return url;
  }
}
github aurelia / http-client / dist / aurelia-http-client.js View on Github external
buildFullUrl(): string {
    let absoluteUrl = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
    let url = absoluteUrl.test(this.url) ? this.url : join(this.baseUrl, this.url);

    if (this.params) {
      let qs = buildQueryString(this.params, this.traditional);
      url = qs ? url + (this.url.indexOf('?') < 0 ? '?' : '&') + qs : url;
    }

    return url;
  }
}
github aurelia / http-client / src / request-message.js View on Github external
buildFullUrl(): string {
    let absoluteUrl = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
    let url = absoluteUrl.test(this.url) ? this.url : join(this.baseUrl, this.url);

    if (this.params) {
      let qs = buildQueryString(this.params);
      url = qs ? url + (this.url.indexOf('?') < 0 ? '?' : '&') + qs : url;
    }

    return url;
  }
}
github aurelia / ux / dist / es2015 / styles / style-strategy.js View on Github external
makeRelativeTo(file) {
        if (this.absolutePath === null) {
            this.absolutePath = relativeToFile(this.path, file);
        }
    }
};
github aurelia / templating-resources / dist / native-modules / css-resource.js View on Github external
return css.replace(cssUrlMatcher, function (match, p1) {
    var quote = p1.charAt(0);
    if (quote === '\'' || quote === '"') {
      p1 = p1.substr(1, p1.length - 2);
    }
    return 'url(\'' + relativeToFile(p1, address) + '\')';
  });
}

aurelia-path

Utilities for path manipulation.

MIT
Latest version published 3 months ago

Package Health Score

72 / 100
Full package analysis