Fix to sorting JavaScript so that vendor and type collections can be properly sorted