Function addTrailingSlash

  • Adds a trailing slash to the end of the segment (if it doesn't already exist)

    Parameters

    • segment: string

    Returns string

    const segment = addTrailingSlash('example');

    console.log(segment); // 'example/'