@pengzhanbo/utils - v3.12.0
    Preparing search index...

    Function parseProtocol

    • Parse protocol from URL.

      从 URL 中解析协议。

      Parameters

      • url: string

        The URL to parse the protocol from.

      Returns string

      The protocol extracted from the URL.

      If the URL is not a valid URL.

      parseProtocol('http://example.com') // => http
      parseProtocol('mailto:[email protected]') // => mailto