mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
20 lines (19 loc) • 719 B
JavaScript
;
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPreferenceKey = getPreferenceKey;
exports.getPreferencesByCategory = getPreferencesByCategory;
function getPreferenceKey(category, name) {
return `${category}--${name}`;
}
function getPreferencesByCategory(myPreferences, category) {
const prefix = `${category}--`;
const preferences = new Map();
Object.keys(myPreferences).forEach((key) => {
if (key.startsWith(prefix)) {
preferences.set(key.substring(prefix.length), myPreferences[key]);
}
});
return preferences;
}