list_render: Convert sorting_functions from object to Map.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-02-12 07:08:25 +00:00
committed by Tim Abbott
parent e5c577aad4
commit 4f39199f6d

View File

@@ -45,7 +45,7 @@ exports.create = function ($container, list, opts) {
const meta = { const meta = {
sorting_function: null, sorting_function: null,
prop: null, prop: null,
sorting_functions: {}, sorting_functions: new Map(),
generic_sorting_functions: {}, generic_sorting_functions: {},
offset: 0, offset: 0,
listRenders: {}, listRenders: {},
@@ -225,7 +225,7 @@ exports.create = function ($container, list, opts) {
/* eslint-disable max-len */ /* eslint-disable max-len */
meta.sorting_function = meta.generic_sorting_functions[sorting_function](prop); meta.sorting_function = meta.generic_sorting_functions[sorting_function](prop);
} else { } else {
meta.sorting_function = meta.sorting_functions[sorting_function]; meta.sorting_function = meta.sorting_functions.get(sorting_function);
} }
} }
@@ -247,7 +247,7 @@ exports.create = function ($container, list, opts) {
}, },
add_sort_function: function (name, sorting_function) { add_sort_function: function (name, sorting_function) {
meta.sorting_functions[name] = sorting_function; meta.sorting_functions.set(name, sorting_function);
}, },
// generic sorting functions are ones that will use a specified prop // generic sorting functions are ones that will use a specified prop