Function addLeadingSlash

  • Simple helper method that add a leading slash / if not yet present.

    Example (es module)

    import { addLeadingSlash } from '@helpers4/url'
    console.log(addLeadingSlash('your/path/without/leading/slash'))
    // => '/your/path/with/leading/slash'

    Example (commonjs)

    var addLeadingSlash = require('@helpers4/url').addLeadingSlash;
    console.log(addLeadingSlash('your/path/without/leading/slash'))
    // => '/your/path/with/leading/slash'

    Parameters

    • url: string

      a valid URL

    Returns string

Generated using TypeDoc