d9bf72a351
sync settings backout nav cases and anon preference key more robust backout header put notificationSettings under backout bar review changes
26 lines
700 B
JavaScript
26 lines
700 B
JavaScript
import { DAEMON_SETTINGS } from 'lbry-redux';
|
|
import isEqual from 'util/deep-equal';
|
|
|
|
export function stringifyServerParam(configList) {
|
|
return configList.reduce((acc, cur) => {
|
|
acc.push(`${cur[0]}:${cur[1]}`);
|
|
return acc;
|
|
}, []);
|
|
}
|
|
|
|
export const getSubsetFromKeysArray = (obj, keys) =>
|
|
Object.keys(obj)
|
|
.filter(i => keys.includes(i))
|
|
.reduce((acc, key) => {
|
|
acc[key] = obj[key];
|
|
return acc;
|
|
}, {});
|
|
|
|
export const shouldSetSetting = (key, val, current) => {
|
|
switch (key) {
|
|
case DAEMON_SETTINGS.LBRYUM_SERVERS:
|
|
return val !== null && Array.isArray(val) && val.length && !isEqual(val, current);
|
|
default:
|
|
return !isEqual(val, current);
|
|
}
|
|
};
|