Function getExtensionsFromRelativePath

  • Extracts all possible extensions from a relative file path.

    This function takes a relative file path and returns an array of all possible extensions, starting from the longest to the shortest. It considers everything after the first dot in the filename as part of the extension.

    Parameters

    • filePath: string

      The relative file path to process.

    Returns string[]

    An array of strings representing all possible extensions, or an empty array if there are no extensions.

    getExtensionsFromRelativePath("folder/file.conf.d.ts")
    // returns ["conf.d.ts", "d.ts", "ts"]