/** * Takes an object and serializes its keys and values into a query string. * Only plain values and arrays of plain values are supported. * * Note: the returned string does *not* contain a leading "?" * * @example * ```ts * import { objectToQuery } from "apprt-core/url-utils"; * const query = objectToQuery({ * a: 1, * b: ["2", 3] * }); * // query === "a=1&b=2&b=3" * ``` * * @param object holds query parameters * @returns the serialized query string */ declare function objectToQuery(object?: Record): string; /** * Parses a query string into an object of key value pairs. * Reoccurring keys are converted into key-array pairs. * No transformation of the individual values is done, i.e. all values will be strings. * * @example * ```ts * import { queryToObject } from "apprt-core/url-utils"; * const object = queryToObject("a=1&b=2&b=3"); * // object is { a: "1", b: ["2", "3"] } * ``` * * @param query The query string. May start with an optional "?" * @returns the parsed object */ declare function queryToObject(query: string | URLSearchParams): Record; /** * Returns true if the given `url` is on a different origin than the current host. */ declare function isCrossDomain(url: URL): boolean; /** * Returns true if the given `url` is on a different host than `origin`. */ declare function isCrossDomainFrom(origin: string, url: URL): boolean; /** * Returns true if the given URL points to a local file system resource, e.g. `file://...`. * * File URLs are sometimes used in native app exports. */ declare function isFileUrl(url: URL): boolean; /** * Helper method to calculate the page base URL. * * @returns {function} Function to return the base URL or given or current page. */ declare function pageBaseUrl(location?: URL): URL; /** * Converts a relative url to an absolute url. * It works only if the relative url is relative to the current page! * @returns {string} absolute url */ declare function toAbsoluteUrl(relativeUrl: string): URL; /** * Checks if a url is absolute * @param {string|undefined} url url to test * @returns {Boolean} true|false */ declare function isAbsoluteUrl(url: string | undefined): boolean; export { isAbsoluteUrl, isCrossDomain, isCrossDomainFrom, isFileUrl, objectToQuery, pageBaseUrl, queryToObject, toAbsoluteUrl };