mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Lodash replacements: take 2
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
@@ -8,10 +7,10 @@ function createMapStateToProps() {
|
|||||||
return createSelector(
|
return createSelector(
|
||||||
createUISettingsSelector(),
|
createUISettingsSelector(),
|
||||||
(uiSettings) => {
|
(uiSettings) => {
|
||||||
return _.pick(uiSettings, [
|
return {
|
||||||
'shortDateFormat',
|
shortDateFormat: uiSettings.shortDateFormat,
|
||||||
'timeFormat'
|
timeFormat: uiSettings.timeFormat
|
||||||
]);
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@@ -14,19 +13,16 @@ function createMapStateToProps() {
|
|||||||
createDimensionsSelector(),
|
createDimensionsSelector(),
|
||||||
createUISettingsSelector(),
|
createUISettingsSelector(),
|
||||||
(calendar, dimensions, uiSettings) => {
|
(calendar, dimensions, uiSettings) => {
|
||||||
const result = _.pick(calendar, [
|
return {
|
||||||
'isFetching',
|
isFetching: calendar.isFetching,
|
||||||
'view',
|
view: calendar.view,
|
||||||
'time',
|
time: calendar.time,
|
||||||
'start',
|
start: calendar.start,
|
||||||
'end'
|
end: calendar.end,
|
||||||
]);
|
isSmallScreen: dimensions.isSmallScreen,
|
||||||
|
collapseViewButtons: dimensions.isLargeScreen,
|
||||||
result.isSmallScreen = dimensions.isSmallScreen;
|
longDateFormat: uiSettings.longDateFormat
|
||||||
result.collapseViewButtons = dimensions.isLargeScreen;
|
};
|
||||||
result.longDateFormat = uiSettings.longDateFormat;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
@@ -8,12 +7,12 @@ function createMapStateToProps() {
|
|||||||
return createSelector(
|
return createSelector(
|
||||||
createUISettingsSelector(),
|
createUISettingsSelector(),
|
||||||
(uiSettings) => {
|
(uiSettings) => {
|
||||||
return _.pick(uiSettings, [
|
return {
|
||||||
'showRelativeDates',
|
showRelativeDates: uiSettings.showRelativeDates,
|
||||||
'shortDateFormat',
|
shortDateFormat: uiSettings.shortDateFormat,
|
||||||
'longDateFormat',
|
longDateFormat: uiSettings.longDateFormat,
|
||||||
'timeFormat'
|
timeFormat: uiSettings.timeFormat
|
||||||
]);
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
@@ -8,12 +7,12 @@ function createMapStateToProps() {
|
|||||||
return createSelector(
|
return createSelector(
|
||||||
createUISettingsSelector(),
|
createUISettingsSelector(),
|
||||||
(uiSettings) => {
|
(uiSettings) => {
|
||||||
return _.pick(uiSettings, [
|
return {
|
||||||
'showRelativeDates',
|
showRelativeDates: uiSettings.showRelativeDates,
|
||||||
'shortDateFormat',
|
shortDateFormat: uiSettings.shortDateFormat,
|
||||||
'longDateFormat',
|
longDateFormat: uiSettings.longDateFormat,
|
||||||
'timeFormat'
|
timeFormat: uiSettings.timeFormat
|
||||||
]);
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@@ -36,13 +35,13 @@ function createMapStateToProps() {
|
|||||||
pendingChanges
|
pendingChanges
|
||||||
} = moviesState;
|
} = moviesState;
|
||||||
|
|
||||||
const movieSettings = _.pick(movie, [
|
const movieSettings = {
|
||||||
'monitored',
|
monitored: movie.monitored,
|
||||||
'qualityProfileId',
|
qualityProfileId: movie.qualityProfileId,
|
||||||
'minimumAvailability',
|
minimumAvailability: movie.minimumAvailability,
|
||||||
'path',
|
path: movie.path,
|
||||||
'tags'
|
tags: movie.tags
|
||||||
]);
|
};
|
||||||
|
|
||||||
const settings = selectSettings(movieSettings, pendingChanges, saveError);
|
const settings = selectSettings(movieSettings, pendingChanges, saveError);
|
||||||
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@@ -10,16 +9,13 @@ function createMapStateToProps() {
|
|||||||
return createSelector(
|
return createSelector(
|
||||||
createMovieSelector(),
|
createMovieSelector(),
|
||||||
(movie) => {
|
(movie) => {
|
||||||
const result = _.pick(movie, [
|
return {
|
||||||
'inCinemas',
|
inCinemas: movie.inCinemas,
|
||||||
'isAvailable',
|
isAvailable: movie.isAvailable,
|
||||||
'monitored',
|
monitored: movie.monitored,
|
||||||
'grabbed'
|
grabbed: movie.grabbed,
|
||||||
]);
|
movieFile: movie.movieFile
|
||||||
|
};
|
||||||
result.movieFile = movie.movieFile;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
|
|
||||||
// See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils
|
// See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils
|
||||||
@@ -10,18 +9,17 @@ export default function parseUrl(url) {
|
|||||||
// The `origin`, `password`, and `username` properties are unavailable in
|
// The `origin`, `password`, and `username` properties are unavailable in
|
||||||
// Opera Presto. We synthesize `origin` if it's not present. While `password`
|
// Opera Presto. We synthesize `origin` if it's not present. While `password`
|
||||||
// and `username` are ignored intentionally.
|
// and `username` are ignored intentionally.
|
||||||
const properties = _.pick(
|
const properties = {
|
||||||
anchor,
|
hash: anchor.hash,
|
||||||
'hash',
|
host: anchor.host,
|
||||||
'host',
|
hostname: anchor.hostname,
|
||||||
'hostname',
|
href: anchor.href,
|
||||||
'href',
|
origin: anchor.origin,
|
||||||
'origin',
|
pathname: anchor.pathname,
|
||||||
'pathname',
|
port: anchor.port,
|
||||||
'port',
|
protocol: anchor.protocol,
|
||||||
'protocol',
|
search: anchor.search
|
||||||
'search'
|
};
|
||||||
);
|
|
||||||
|
|
||||||
properties.isAbsolute = (/^[\w:]*\/\//).test(url);
|
properties.isAbsolute = (/^[\w:]*\/\//).test(url);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user