How to use url-join - 10 common examples

To help you get started, we’ve selected a few url-join 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 edsilv / biiif / Directory.ts View on Github external
canvasJson.items[0].id = urljoin(this.url.href, 'index.json/canvas', index, 'annotationpage/0');

                await canvas.read(canvasJson);

                // add canvas to items
                this.indexJson.items.push(canvasJson);

                index++;
            }

            this.indexJson.items.sort((a, b) => {
                return Utils.compare(a.id, b.id);
            });
        }

        this.indexJson.id = urljoin(this.url.href, 'index.json');

        this._applyInfo();

        await Utils.getThumbnail(this.indexJson, this);

        // write index.json
        const path: string = join(this.directoryPath, 'index.json');
        const json: string = JSON.stringify(this.indexJson, null, '  ');

        console.log(chalk.green('creating index.json for: ') + this.directoryPath);

        await Utils.writeJson(path, json);
    }
github weseek / growi / src / client / js / components / PageEditor / CodeMirrorEditor.jsx View on Github external
loadKeymapMode(keymapMode) {
    const loadCss = this.loadCss;
    const scriptList = [];
    const cssList = [];

    // add dependencies
    if (this.loadedKeymapSet.size === 0) {
      const dialogScriptUrl = this.props.noCdn
        ? urljoin(this.cmNoCdnScriptRoot, 'codemirror-dialog.js')
        : urljoin(this.cmCdnRoot, 'addon/dialog/dialog.min.js');
      const dialogStyleUrl = this.props.noCdn
        ? urljoin(this.cmNoCdnStyleRoot, 'codemirror-dialog.css')
        : urljoin(this.cmCdnRoot, 'addon/dialog/dialog.min.css');

      scriptList.push(loadScript(dialogScriptUrl));
      cssList.push(loadCss(dialogStyleUrl));
    }
    // load keymap
    if (!this.loadedKeymapSet.has(keymapMode)) {
      const keymapScriptUrl = this.props.noCdn
        ? urljoin(this.cmNoCdnScriptRoot, `codemirror-keymap-${keymapMode}.js`)
        : urljoin(this.cmCdnRoot, `keymap/${keymapMode}.min.js`);
      scriptList.push(loadScript(keymapScriptUrl));
      // update Set
      this.loadedKeymapSet.add(keymapMode);
github weseek / growi / src / client / js / components / PageEditor / CodeMirrorEditor.jsx View on Github external
loadTheme(theme) {
    if (!this.loadedThemeSet.has(theme)) {
      const url = this.props.noCdn
        ? urljoin(this.cmNoCdnStyleRoot, `codemirror-theme-${theme}.css`)
        : urljoin(this.cmCdnRoot, `theme/${theme}.min.css`);

      this.loadCss(url);

      // update Set
      this.loadedThemeSet.add(theme);
    }
  }
github jupyter-attic / dashboards_server / app / handlebars-helpers.js View on Github external
urlJoin: function() {
        // need varargs but Handlebars adds an arg to the end, so slice it off
        var args = Array.apply(null, arguments).slice(0, arguments.length-1);
        return urljoin.apply(null, args);
    },
github JetBrains / youtrack-mobile / src / components / auth / auth__oauth.android.js View on Github external
function openAuthPage(config: AppConfig) {
  Linking.openURL(encodeURI(urlJoin(
    config.auth.serverUri,
    '/api/rest/oauth2/auth',
    '?response_type=code',
    '&access_type=offline',
    `&client_id=${config.auth.clientId}`,
    `&scope=${config.auth.scopes}`,
    `&redirect_uri=${config.auth.landingUrl}`
  )));
}
github nteract / nteract / packages / rx-jupyter / src / kernels.ts View on Github external
serverConfig: ServerConfig,
  kernelID: string,
  sessionID?: string
): string => {
  const params = new URLSearchParams();
  if (serverConfig.token) {
    params.append("token", serverConfig.token);
  }
  if (sessionID) {
    params.append("session_id", sessionID);
  }

  const q = params.toString();
  const suffix = q !== "" ? `?${q}` : "";

  const url = urljoin(
    serverConfig.endpoint || "",
    `/api/kernels/${kernelID}/channels${suffix}`
  );

  return url.replace(/^http(s)?/, "ws$1");
};
github France-ioi / codecast / backend / offline.js View on Github external
request(`${query.base}.json`, function (err, response, body) {
        if (err) return res.status(400).send(err.toString());
        if (response.statusCode != 200) return res.status(response.statusCode).send(body);
        try {
          options.data = JSON.parse(body);
        } catch (ex) {
          return res.status(400).send(ex.toString());
        }
        res.render('offline', {
          options,
          baseUrl: `${urlJoin(pathReverse(ownPath), sharedPath)}`
        });
      });
    });
github mirumee / saleor-dashboard / src / attributes / urls.ts View on Github external
export const attributePath = (id: string) => urlJoin(attributeSection, id);
export const attributeUrl = (id: string, params?: AttributeUrlQueryParams) =>
github buttercup / buttercup-browser-extension / source / shared / library / secureFileClient.js View on Github external
readFile: (remotePath, options, callback) => {
            const cb = typeof options === "function" ? options : callback;
            const url = joinURL(BASE_URL, "/get/file");
            createSession()
                .encrypt(remotePath, token)
                .then(payload =>
                    fetch(url, {
                        method: "POST",
                        headers: {
                            "Content-Type": "application/json; charset=utf-8"
                        },
                        body: JSON.stringify({
                            payload
                        })
                    })
                )
                .then(response => {
                    if (response.ok && response.status === 200) {
                        return response.json();
github JetBrains / youtrack-mobile / src / components / api / api.js View on Github external
async getUserFromHub(id: string) {
    const queryString = qs.stringify({fields: 'avatar/url'});
    return await this.makeAuthorizedRequest(
      urlJoin(this.auth.config.auth.serverUri, `/api/rest/users/${id}?${queryString}`)
    );
  }

url-join

Join urls and normalize as in path.join.

MIT
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis

Popular url-join functions