std
    Preparing search index...

    Function addLeadingAndTrailingSlash

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

      Parameters

      • segment: string

      Returns string

      const segment = addLeadingAndTrailingSlash('example');

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