How to use the uri-js.parse function in uri-js

To help you get started, we’ve selected a few uri-js 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 vimlet / bundl / tests / features / font / node_modules / ajv / lib / compile / resolve.js View on Github external
function resolveSchema(root, ref) {
  /* jshint validthis: true */
  var p = URI.parse(ref)
    , refPath = _getFullPath(p)
    , baseId = getFullPath(this._getId(root.schema));
  if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
    var id = normalizeId(refPath);
    var refVal = this._refs[id];
    if (typeof refVal == 'string') {
      return resolveRecursive.call(this, root, refVal, p);
    } else if (refVal instanceof SchemaObject) {
      if (!refVal.validate) this._compile(refVal);
      root = refVal;
    } else {
      refVal = this._schemas[id];
      if (refVal instanceof SchemaObject) {
        if (!refVal.validate) this._compile(refVal);
        if (id == normalizeId(ref))
          return { schema: refVal, root: root, baseId: baseId };
github codekirei / node-multispinner / extras / examples / cli-with-promises / index.js View on Github external
function download(url, spinnerID, spinners) {
  // if url scheme is undetected, slap an http in front and retry
  if (!uri.parse(url).scheme) {
    return download('http://' + url, spinnerID, spinners)
  }

  // GET request promise
  return axios
    .get(url)
    .then(success => {
      spinners.success(spinnerID)
      return [spinnerID, success]
    })
    .catch(err => {
      // follow redirects
      if (300 < err.status && err.status < 400) {
        return download(err.headers.location, spinnerID, spinners)
      }
      spinners.error(spinnerID)
github travisghansen / external-auth-server / src / plugin / oauth / index.js View on Github external
get_authorization_redirect_uri(uri) {
    const plugin = this;
    const query = {};

    if (plugin.config.redirect_uri) {
      uri = plugin.config.redirect_uri;
    } else {
      // set this in the /oauth/callback endpoint manually to avoid sending non-standard params to providers
      // ie: okta pukes when it sees this
      query[HANDLER_INDICATOR_PARAM_NAME] = "authorization_callback";
    }

    const parsedURI = URI.parse(uri);
    if (Object.keys(query).length) {
      parsedURI.query = queryString.stringify(query);
    }

    return URI.serialize(parsedURI);
  }
github EdgeApp / edge-react-gui / src / components / Main.ui.js View on Github external
doDeepLink (url: string) {
    const parsedUri = URI.parse(url)
    const query = parsedUri.query
    if (!query || !query.includes('token=')) {
      return
    }
    const splitArray = query.split('token=')
    const nextString = splitArray[1]
    const finalArray = nextString.split('&')
    const token = finalArray[0]
    this.props.urlReceived(token)
  }
  handleOpenURL = (event: Object) => {
github bhauman / react-native-figwheel-bridge / figwheel-bridge.js View on Github external
function correctUrl(url) {
    var u = URI.parse(url);
    if(isChrome()) {
	u.host = "localhost";
    }
    return URI.serialize(u);
}
github EdgeApp / edge-react-gui / src / components / Main.ui.js View on Github external
doDeepLink (url: string) {
    const parsedUri = URI.parse(url)

    switch (parsedUri.scheme) {
      case 'edge':
      case 'airbitz':
      case 'edge-ret':
      case 'airbitz-ret':
      case 'https':
        if (parsedUri.host === 'recovery' || parsedUri.host === 'recovery.edgesecure.co') {
          this.handleRecoveryToken(parsedUri)
        } else {
          this.handleAddress(parsedUri, url)
        }
        break
      case 'bitcoin':
      case 'bitcoincash':
      case 'ethereum':
github gabceb / node-metainspector / index.js View on Github external
function withDefaultScheme(url) {
	return URI.parse(url).scheme ? url : "http://" + url;
}
github adobe / helix-pipeline / src / html / find-embeds.js View on Github external
function iaEmbed({ type, children }) {
  if (type === 'paragraph'
    && children.length === 1
    && children[0].type === 'link'
    && URI.parse(children[0].url).reference === 'absolute') {
    return URI.parse(children[0].url);
  }
  return false;
}
github travisghansen / external-auth-server / src / plugin / oauth / index.js View on Github external
try {
          let state = server.utils.decrypt(
            issuer_encrypt_secret,
            req.query.state,
            "hex"
          );
          state = jwt.verify(state, issuer_sign_secret);
          const state_redirect_uri = state.request_uri;

          const parsedStateRedirectURI = URI.parse(state_redirect_uri);
          server.logger.verbose(
            "parsed state redirect uri: %j",
            parsedStateRedirectURI
          );

          const parsedRequestURI = URI.parse(req.url);
          server.logger.verbose("parsed request uri: %j", parsedRequestURI);

          const parsedRedirectURI = Object.assign({}, parsedStateRedirectURI);
          const parsedQuery = queryString.parse(parsedRequestURI.query);
          parsedQuery[HANDLER_INDICATOR_PARAM_NAME] = "authorization_callback";
          parsedRedirectURI.query = queryString.stringify(parsedQuery);
          server.logger.verbose("parsed redirect uri: %j", parsedRedirectURI);

          const redirect_uri = URI.serialize(parsedRedirectURI);
          server.logger.info("redirecting browser to: %j", redirect_uri);

          res.statusCode = 302;
          res.setHeader("Location", redirect_uri);
          res.end();
          return;
        } catch (e) {
github adobe / helix-pipeline / src / html / find-embeds.js View on Github external
function imgEmbed({ type, children }) {
  if (type === 'paragraph'
    && children.length === 1
    && children[0].type === 'image'
    && URI.parse(children[0].url).reference === 'absolute'
    && !URI.parse(children[0].url).path.match(/(jpe?g)|png|gif|webm$/i)) {
    return URI.parse(children[0].url);
  }
  return false;
}

uri-js

An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.

BSD-2-Clause
Latest version published 4 years ago

Package Health Score

67 / 100
Full package analysis