Function removeLeadingAndTrailingSlash

Removes the leading and trailing slash from the segment (if they exist)

const segment = removeLeadingAndTrailingSlash('/example/');

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

    • segment: string

    Returns string