{"size": 757, "ext": "js", "max_stars_repo_path": "docs/documentation/node_modules/@docusaurus/core/lib/client/exports/useBaseUrl.js", "max_stars_repo_name": "manolis-kapetanakis-cko/checkout-sdk-net-doc", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "docs/documentation/node_modules/@docusaurus/core/lib/client/exports/useBaseUrl.js", "max_issues_repo_name": "manolis-kapetanakis-cko/checkout-sdk-net-doc", "max_issues_repo_issues_event_min_datetime": "2021-03-01T21:24:38.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T08:43:44.000Z", "max_forks_repo_path": "docs/documentation/node_modules/@docusaurus/core/lib/client/exports/useBaseUrl.js", "max_forks_repo_name": "manolis-kapetanakis-cko/checkout-sdk-net-doc", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 8, "max_forks_count": null, "avg_line_length": 32.9130434783, "max_line_length": 97, "alphanum_fraction": 0.6446499339}
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
import useDocusaurusContext from './useDocusaurusContext';
import isInternalUrl from './isInternalUrl';
export default function useBaseUrl(url, { forcePrependBaseUrl = false, absolute = false } = {}) {
    const { siteConfig: { baseUrl = '/', url: siteUrl } = {}, } = useDocusaurusContext();
    if (!url) {
        return url;
    }
    if (forcePrependBaseUrl) {
        return baseUrl + url;
    }
    if (!isInternalUrl(url)) {
        return url;
    }
    const basePath = baseUrl + url.replace(/^\//, '');
    return absolute ? siteUrl + basePath : basePath;
}
