UNPKG

@prismicio/client

Version:

The official JavaScript + TypeScript client library for Prismic

18 lines (17 loc) 700 B
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const PrismicError = require("./errors/PrismicError.cjs"); const getRepositoryName = (repositoryEndpoint) => { try { const hostname = new URL(repositoryEndpoint).hostname; if (hostname.endsWith("prismic.io") || // Production hostname.endsWith("wroom.io") || // Staging hostname.endsWith("wroom.test")) { return hostname.split(".")[0]; } } catch { } throw new PrismicError.PrismicError(`An invalid Prismic Document API endpoint was provided: ${repositoryEndpoint}`, void 0, void 0); }; exports.getRepositoryName = getRepositoryName; //# sourceMappingURL=getRepositoryName.cjs.map