@adviser/cement - v0.0.0
    Preparing search index...

    Function relativePath

    • Resolves a relative path against a base path and normalizes the result.

      If the relative path is absolute, returns it directly. Otherwise, joins the base and relative paths, then normalizes by resolving ".." (parent) and "." (current) directory references.

      Parameters

      • path: string

        Base path to resolve against

      • relative: string

        Relative path to resolve (or absolute path)

      Returns string

      Normalized resolved path

      relativePath('/home/user', 'docs/file.txt');
      // '/home/user/docs/file.txt'

      relativePath('/home/user/project', '../config.json');
      // '/home/user/config.json'

      relativePath('/home/user', '/etc/hosts');
      // '/etc/hosts' (absolute path takes precedence)

      relativePath('/a/b/c', '../../d');
      // '/a/d'