mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 05:53:43 +00:00
js: Extract FoldDict class.
We have ~5 years of proof that we'll probably never extend Dict with more options. Breaking the classes into makes both a little faster (no options to check), and we remove some options in FoldDict that are never used (from/from_array). A possible next step is to fine-tune the Dict to use Map internally. Note that the TypeScript types for FoldDict are now more specific (requiring string keys). Of course, this isn't really enforced until we convert other modules to TS.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const Dict = require('./dict').Dict;
|
||||
const FoldDict = require('./fold_dict').FoldDict;
|
||||
|
||||
let user_group_name_dict;
|
||||
let user_group_by_id_dict;
|
||||
@@ -6,7 +7,7 @@ let user_group_by_id_dict;
|
||||
// We have an init() function so that our automated tests
|
||||
// can easily clear data.
|
||||
exports.init = function () {
|
||||
user_group_name_dict = new Dict({fold_case: true});
|
||||
user_group_name_dict = new FoldDict();
|
||||
user_group_by_id_dict = new Dict();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user