Function extractPureURI

  • Extract only the URI from a path with optional query and fragments.

    For example, all these parameters will returns /path:

    • /path
    • /path?query=thing
    • /path#fragment
    • /path?query=thing#fragment

    Example (es module)

    import { extractPureURI } from '@helpers4/url'
    console.log(extractPureURI('https://www.google.com/?q=search'))
    // => 'https://www.google.com/'

    Example (commonjs)

    var extractPureURI = require('@helpers4/url').extractPureURI;
    console.log(extractPureURI('https://www.google.com/?q=search'))
    // => 'https://www.google.com/'

    Parameters

    • path: string

      a complete path without server part.

    Returns string

Generated using TypeDoc