JS Utils Kit
    Preparing search index...

    Function toPlatformPath

    • Converts a file system path to the current platform-specific format.

      This replaces both forward slashes (/) and backslashes (\) with the platform's separator (path.sep).

      • Windows → \
      • macOS/Linux → /

      Parameters

      • p: string

        The path to convert

      Returns string

      The path using the current OS separator.

      toPlatformPath('src/utils/file.ts')
      // On Windows: 'src\\utils\\file.ts'
      // On POSIX: 'src/utils/file.ts'