Replaced coalesce with real ?? operator
This commit is contained in:
parent
f8afae8b3c
commit
5c860b322b
|
@ -1,39 +1,26 @@
|
||||||
import coalesce from '@/utils/coalesce';
|
|
||||||
|
|
||||||
// Use stored value if not null, othewise fallback to config, then default values
|
// Use stored value if not null, othewise fallback to config, then default values
|
||||||
export default {
|
export default {
|
||||||
GET_AUTOPLAY: (state, getters, rootState, rootGetters) => coalesce(state.autoplay,
|
GET_AUTOPLAY: (state, getters, rootState, rootGetters) => state.autoplay
|
||||||
rootGetters.GET_CONFIG.default_slplayer_autoplay),
|
?? rootGetters.GET_CONFIG.default_slplayer_autoplay,
|
||||||
|
|
||||||
GET_CLIENTPOLLINTERVAL: (state, getters, rootState, rootGetters) => coalesce(
|
GET_CLIENTPOLLINTERVAL: (state, getters, rootState, rootGetters) => state.clientPollInterval
|
||||||
state.clientPollInterval,
|
?? rootGetters.GET_CONFIG.default_client_poll_interval,
|
||||||
rootGetters.GET_CONFIG.default_client_poll_interval,
|
|
||||||
),
|
|
||||||
|
|
||||||
GET_SYNCMODE: (state, getters, rootState, rootGetters) => coalesce(
|
GET_SYNCMODE: (state, getters, rootState, rootGetters) => state.syncMode
|
||||||
state.syncMode,
|
?? rootGetters.GET_CONFIG.default_sync_mode,
|
||||||
rootGetters.GET_CONFIG.default_sync_mode,
|
|
||||||
),
|
|
||||||
|
|
||||||
GET_SYNCFLEXIBILITY: (state, getters, rootState, rootGetters) => coalesce(
|
GET_SYNCFLEXIBILITY: (state, getters, rootState, rootGetters) => state.syncFlexibility
|
||||||
state.syncFlexibility,
|
?? rootGetters.GET_CONFIG.default_sync_flexability,
|
||||||
rootGetters.GET_CONFIG.default_sync_flexability,
|
|
||||||
),
|
|
||||||
|
|
||||||
GET_SLPLAYERQUALITY: (state, getters, rootState, rootGetters) => coalesce(
|
GET_SLPLAYERQUALITY: (state, getters, rootState, rootGetters) => state.slPlayerQuality
|
||||||
state.slPlayerQuality,
|
?? rootGetters.GET_CONFIG.default_slplayer_quality ?? null,
|
||||||
rootGetters.GET_CONFIG.default_slplayer_quality,
|
|
||||||
) || null,
|
|
||||||
|
|
||||||
GET_SLPLAYERVOLUME: (state, getters, rootState, rootGetters) => coalesce(
|
GET_SLPLAYERVOLUME: (state, getters, rootState, rootGetters) => state.slPlayerVolume
|
||||||
state.slPlayerVolume,
|
?? rootGetters.GET_CONFIG.default_slplayer_volume,
|
||||||
rootGetters.GET_CONFIG.default_slplayer_volume,
|
|
||||||
),
|
|
||||||
|
|
||||||
GET_SLPLAYERFORCETRANSCODE: (state, getters, rootState, rootGetters) => coalesce(
|
GET_SLPLAYERFORCETRANSCODE: (state, getters, rootState, rootGetters) => state
|
||||||
state.slPlayerForceTranscode,
|
.slPlayerForceTranscode
|
||||||
rootGetters.GET_CONFIG.default_slplayer_force_transcode,
|
?? rootGetters.GET_CONFIG.default_slplayer_force_transcode,
|
||||||
),
|
|
||||||
|
|
||||||
GET_HIDEUSERNAME: (state) => state.hideUsername,
|
GET_HIDEUSERNAME: (state) => state.hideUsername,
|
||||||
GET_ALTUSERNAME: (state) => state.altUsername,
|
GET_ALTUSERNAME: (state) => state.altUsername,
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
const coalesce = (...arr) => arr.find((element) => element !== null && element !== undefined);
|
|
||||||
|
|
||||||
export default coalesce;
|
|
Loading…
Reference in New Issue