Function addLeadingAndTrailingSlash

Adds a leading and trailing to the beginning and end of the segment (if it doesn't already exist)

const segment = addLeadingAndTrailingSlash('example');

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

    • segment: string

    Returns string