PHP 8.2.30
Preview: buildURL.js Size: 1.54 KB
/home/byroehnu/easepay.easetack.com/node_modules/axios/lib/helpers/buildURL.js

'use strict';

import utils from '../utils.js';
import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';

/**
 * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
 * URI encoded counterparts
 *
 * @param {string} val The value to be encoded.
 *
 * @returns {string} The encoded value.
 */
function encode(val) {
  return encodeURIComponent(val).
    replace(/%3A/gi, ':').
    replace(/%24/g, '$').
    replace(/%2C/gi, ',').
    replace(/%20/g, '+');
}

/**
 * Build a URL by appending params to the end
 *
 * @param {string} url The base of the url (e.g., http://www.google.com)
 * @param {object} [params] The params to be appended
 * @param {?(object|Function)} options
 *
 * @returns {string} The formatted url
 */
export default function buildURL(url, params, options) {
  if (!params) {
    return url;
  }

  const _encode = options && options.encode || encode;

  const _options = utils.isFunction(options) ? {
    serialize: options
  } : options;

  const serializeFn = _options && _options.serialize;

  let serializedParams;

  if (serializeFn) {
    serializedParams = serializeFn(params, _options);
  } else {
    serializedParams = utils.isURLSearchParams(params) ?
      params.toString() :
      new AxiosURLSearchParams(params, _options).toString(_encode);
  }

  if (serializedParams) {
    const hashmarkIndex = url.indexOf("#");

    if (hashmarkIndex !== -1) {
      url = url.slice(0, hashmarkIndex);
    }
    url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  }

  return url;
}

Directory Contents

Dirs: 0 × Files: 33

Name Size Perms Modified Actions
127 B lr--r--r-- 2026-03-14 01:49:09
Edit Download
3.59 KB lrw-r--r-- 2026-02-20 03:53:04
Edit Download
1.41 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
444 B lrw-r--r-- 2026-02-20 03:53:06
Edit Download
1.54 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
372 B lrw-r--r-- 2026-02-20 03:53:06
Edit Download
382 B lrw-r--r-- 2026-02-20 03:53:06
Edit Download
1.33 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
1.30 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
746 B lrw-r--r-- 2026-02-20 03:53:06
Edit Download
2.01 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
2.11 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
2.90 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
1.33 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
1.72 KB lrw-r--r-- 2026-02-20 03:53:06
Edit Download
618 B lrw-r--r-- 2026-02-20 03:53:06
Edit Download
371 B lrw-r--r-- 2026-02-20 03:53:06
Edit Download
420 B lrw-r--r-- 2026-02-20 03:53:08
Edit Download
56 B lrw-r--r-- 2026-02-20 03:53:08
Edit Download
1.35 KB lrw-r--r-- 2026-02-20 03:53:08
Edit Download
151 B lrw-r--r-- 2026-02-20 03:53:08
Edit Download
1.21 KB lrw-r--r-- 2026-02-20 03:53:08
Edit Download
318 B lrw-r--r-- 2026-02-20 03:53:08
Edit Download
351 B lrw-r--r-- 2026-02-20 03:53:18
Edit Download
2.15 KB lrw-r--r-- 2026-02-20 03:53:08
Edit Download
1.07 KB lrw-r--r-- 2026-02-20 03:53:08
Edit Download
566 B lrw-r--r-- 2026-02-20 03:53:08
Edit Download
852 B lrw-r--r-- 2026-02-20 03:53:10
Edit Download
5.97 KB lrw-r--r-- 2026-02-20 03:53:10
Edit Download
540 B lrw-r--r-- 2026-02-20 03:53:10
Edit Download
1.65 KB lrw-r--r-- 2026-02-20 03:53:10
Edit Download
2.72 KB lrw-r--r-- 2026-02-20 03:53:12
Edit Download
681 B lrw-r--r-- 2026-02-20 03:53:12
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).