Function removeTrailingSlash

  • Removes the trailing slash from the end of the segment (if it exists)

    Parameters

    • segment: string

    Returns string

    const segment = removeTrailingSlash('example/');

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