Underscore.js _.map() to native Array.map() (optional with Object.entries/values)

This commit is contained in:
djmaze 2020-07-22 20:09:31 +02:00
parent 032fa8c736
commit a82575a830
27 changed files with 68 additions and 78 deletions

View file

@ -48,7 +48,7 @@ class ContactsAdminSettings {
this.contactsTypes = ko.observableArray([]);
this.contactsTypesOptions = ko.computed(() =>
_.map(this.contactsTypes(), (value) => {
this.contactsTypes().map(value => {
const disabled = supportedTypes.includes(value);
return {
'id': value,

View file

@ -63,7 +63,7 @@ class GeneralAdminSettings {
: '';
this.themesOptions = ko.computed(() =>
_.map(this.themes(), (theme) => ({ optValue: theme, optText: convertThemeName(theme) }))
this.themes().map(theme => ({ optValue: theme, optText: convertThemeName(theme) }))
);
this.languageFullName = ko.computed(() => convertLangName(this.language()));

View file

@ -114,7 +114,7 @@ class FiltersUserSettings {
this.filters(
_.compact(
_.map(data.Result.Filters, (aItem) => {
data.Result.Filters.map(aItem => {
const filter = new FilterModel();
return filter && filter.parse(aItem) ? filter : null;
})

View file

@ -1,5 +1,4 @@
import window from 'window';
import _ from '_';
import ko from 'ko';
import Jua from 'Jua';
@ -63,7 +62,7 @@ class ThemesUserSettings {
const currentTheme = this.theme();
this.themesObjects(
_.map(this.themes(), (theme) => ({
this.themes().map(theme => ({
name: theme,
nameDisplay: convertThemeName(theme),
selected: ko.observable(theme === currentTheme),