Const
import type { ImportMapSortedEntries } from "./typedefs.ts"
import { assertEquals } from "jsr:@std/assert"
const my_import_map_entries: ImportMapSortedEntries = [
["./hello/", "https://example.com/hello-greetings/"],
["./hello/world/", "https://example.com/hello-world/"],
["./hello/abc/", "https://example.com/hello-abc/"],
["./hello", "https://example.com/"],
]
assertEquals(my_import_map_entries.toSorted(compareImportMapEntriesByLength), [
["./hello/world/", "https://example.com/hello-world/"],
["./hello/abc/", "https://example.com/hello-abc/"],
["./hello/", "https://example.com/hello-greetings/"],
["./hello", "https://example.com/"],
])
use this compare-function to sort import-map entries by the key-alias's length, in decreasing order.