Edit Distance in a Word Index


I had a random thought today while looking for a word in a list, what if those words were ordered by edit distance rather than alphabetically , since in that instance I saw almost what I wanted, but the first letter was different, which meant this was nowhere near the correct place. Anyways, made a trivial thing here that can sort things first alphabetically and then according to edit distance to the first entry. The first sort helps make things more predictable, as oftentimes the edit distance is equal and since ECMAScript requires Array.sort to be stable, doing this produces a good ordering by first distance and secondarily alphabetically.