--!native --!optimize 2 -- Compiled with roblox-ts v3.0.0 local TS = _G[script] local Scores = TS.import(script, script.Parent.Parent, "Scores").Scores --[[ *higher - better * @param output_terms if terms were transformed, here could be the original terms ]] local function FuzzyScoreSorting(terms, query, output_terms) if output_terms == nil then output_terms = terms end local _exp = table.create(#terms, 0) -- ▼ ReadonlyArray.map ▼ local _newValue = table.create(#_exp) local _callback = function(_, i) return { Scores.FuzzyScore(terms[i + 1], query), output_terms[i + 1] } end for _k, _v in _exp do _newValue[_k] = _callback(_v, _k - 1, _exp) end -- ▲ ReadonlyArray.map ▲ table.sort(_newValue, function(_param, _param_1) local a = _param[1] local b = _param_1[1] return a > b end) return _newValue end return { FuzzyScoreSorting = FuzzyScoreSorting, }