@types/relateurl

  • Version 0.2.33
  • Published
  • 6.49 kB
  • No dependencies
  • MIT license

Install

npm i @types/relateurl
yarn add @types/relateurl
pnpm add @types/relateurl

Overview

TypeScript definitions for relateurl

Index

Classes

class RelateUrl

class RelateUrl {}

    constructor

    constructor(from: string, options?: RelateUrl.Options);

      property ABSOLUTE

      static ABSOLUTE: string;

        property PATH_RELATIVE

        static PATH_RELATIVE: string;

          property ROOT_RELATIVE

          static ROOT_RELATIVE: string;

            property SHORTEST

            static SHORTEST: string;

              method relate

              static relate: (from: string, to: string, options?: RelateUrl.Options) => string;

                Interfaces

                interface Options

                interface Options {}

                  property defaultPorts

                  defaultPorts?: Object | undefined;
                  • Type: Object Default value: {ftp:21, http:80, https:443}

                    Extend the list with any ports you need. Any URLs containing these default ports will have them removed. Example: http://example.com:80/ will become http://example.com/.

                  property directoryIndexes

                  directoryIndexes?: string[] | undefined;
                  • Type: Array Default value: ["index.html"]

                    Extend the list with any resources you need. Works with options.removeDirectoryIndexes.

                  property ignore_www

                  ignore_www?: boolean | undefined;
                  • Type: Boolean Default value: false

                    This will, for example, consider any domains containing http://www.example.com/ to be related to any that contain http://example.com/.

                  property output

                  output?: string | undefined;
                  • Type: constant or String Choices: RelateUrl.ABSOLUTE,RelateUrl.PATH_RELATIVE,RelateUrl.ROOT_RELATIVE,RelateUrl.SHORTEST Choices: "absolute","pathRelative","rootRelative","shortest" Default value: RelateUrl.SHORTEST

                    RelateUrl.ABSOLUTE will produce an absolute URL. Overrides options.schemeRelative with a value of false. RelateUrl.PATH_RELATIVE will produce something like ../child-of-parent/etc/. RelateUrl.ROOT_RELATIVE will produce something like /child-of-root/etc/. RelateUrl.SHORTEST will choose whichever is shortest between root- and path-relative.

                  property rejectedSchemes

                  rejectedSchemes?: string[] | undefined;
                  • Type: Array Default value: ["data","javascript","mailto"]

                    Extend the list with any additional schemes. Example: javascript:something will not be modified.

                  property removeAuth

                  removeAuth?: boolean | undefined;
                  • Type: Boolean Default value: false

                    Remove user authentication information from the output URL.

                  property removeDirectoryIndexes

                  removeDirectoryIndexes?: boolean | undefined;
                  • Type: Boolean Default value: true

                    Remove any resources that match any found in options.directoryIndexes.

                  property removeEmptyQueries

                  removeEmptyQueries?: boolean | undefined;
                  • Type: Boolean Default value: false

                    Remove empty query variables. Example: http://domain.com/?var1&var2=&var3=asdf will become http://domain.com/?var3=adsf. This does not apply to unrelated URLs (with other protocols, auths, hosts and/or ports).

                  property removeRootTrailingSlash

                  removeRootTrailingSlash?: boolean | undefined;
                  • Type: Boolean Default value: true

                    Remove trailing slashes from root paths. Example: http://domain.com/?var will become http://domain.com?var while http://domain.com/dir/?var will not be modified.

                  property schemeRelative

                  schemeRelative?: boolean | undefined;
                  • Type: Boolean Default value: true

                    Output URLs relative to the scheme. Example: http://example.com/ will become //example.com/.

                  property site

                  site?: string | undefined;
                  • Type: String Default value: undefined

                    An options-based version of the from argument. If both are specified, from takes priority.

                  property slashesDenoteHost

                  slashesDenoteHost?: boolean | undefined;
                  • Type: Boolean Default value: true

                    Passed to Node's url.parse.

                  Package Files (1)

                  Dependencies (0)

                  No dependencies.

                  Dev Dependencies (0)

                  No dev dependencies.

                  Peer Dependencies (0)

                  No peer dependencies.

                  Badge

                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/relateurl.

                  • Markdown
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/relateurl)
                  • HTML
                    <a href="https://www.jsdocs.io/package/@types/relateurl"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>