Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createSelectorFromSpec(spec) {
if (spec instanceof MapSelectorSpec) {
// eslint-disable-next-line no-underscore-dangle
const parentSelector = createSelectorFromSpec(spec._parent);
return spec.createResultFunc(parentSelector);
}
return createCachedSelector(
spec.dependencies,
spec.resultFunc
)({
keySelector: spec.keySelector,
cacheObject: new FlatMapCache(),
selectorCreator: createSelector, // eslint-disable-line no-use-before-define
});
}
function createSelectorFromSpec(spec) {
if (spec instanceof MapSelectorSpec) {
// eslint-disable-next-line no-underscore-dangle
const parentSelector = createSelectorFromSpec(spec._parent);
return spec.createResultFunc(parentSelector);
}
return createCachedSelector(
spec.dependencies,
spec.resultFunc
)({
keySelector: spec.keySelector,
cacheObject: new FlatMapCache(),
selectorCreator: createSelector, // eslint-disable-line no-use-before-define
});
}
}
function selectMarketsDataStateMarket(state, marketId) {
return selectMarketInfosState(state)[marketId];
}
function selectMarketTradingHistoryStateMarket(state, marketId) {
return selectMarketTradingHistoryState(state)[marketId];
}
export default function(marketId) {
if (!marketId) return [];
return selectUserFilledOrders(store.getState(), marketId);
}
export const selectUserFilledOrders = createCachedSelector(
selectMarketTradingHistoryStateMarket,
selectLoginAccountAddress,
selectMarketsDataStateMarket,
selectUserOpenOrders,
(marketTradeHistory, accountId, marketInfos, openOrders) => {
if (
!marketTradeHistory ||
marketTradeHistory.length < 1 ||
marketInfos === undefined
) {
return [];
}
const tradesCreatedOrFilledByThisAccount = marketTradeHistory.filter(
(trade) => isSameAddress(trade.creator, accountId) || isSameAddress(trade.filler, accountId),
);
import createCachedSelector from "re-reselect";
import { find } from "lodash-es";
import { AppState, createStructuredSelector } from "@/state";
import { spaceManagerSelector } from "../../selectors/space-manager";
import { AbstractPlanetProps } from "./props";
const planetIdSelector = (_: AppState, props: AbstractPlanetProps) =>
props.planetId;
const planetSelector = createCachedSelector(
spaceManagerSelector,
planetIdSelector,
(spaceManager, planetId) => {
if (!spaceManager) {
return null;
}
const planet = find(spaceManager.destinations, x => x.id === planetId);
return planet || null;
}
)(planetIdSelector);
const mapStateToProps = createStructuredSelector({
planet: planetSelector
});
) => {
const resource = resourceSelector(state, resourceName);
if (resource) {
return !(applyDenormalizer && denormalizer)
? `${!!(applyDenormalizer && denormalizer)}-${getResourceHash(
state,
resourceName,
)}`
: `${!!(applyDenormalizer && denormalizer)}-${getResourcesHash(state)}`;
}
return getEmptyResourceHash();
};
const getResource = createCachedSelector(
resourcesSelector,
resourceSelector,
applyDenormalizerSelector,
denormalizerSelector,
getResourceSelector,
)(getResourceResolver, getReReselectOptions());
const getResourceById = (
state,
resourceName,
resourceId,
applyDenormalizer,
denormalizer,
) => {
const resource
= state.resources
import createCachedSelector from "re-reselect";
import { get } from "lodash-es";
import { AppState } from "@/state";
import oniSave from "@/selectors/oni-save";
import { EditorFieldProps } from "./props";
const itemPathSelector = (_: AppState, props: EditorFieldProps) => props.path;
const cacheKeyGenerator = (_: AppState, props: EditorFieldProps) =>
props.path.join(".");
const itemValue = createCachedSelector(
itemPathSelector,
oniSave,
(path, oniSave) => {
if (path.length === 0) {
return oniSave;
}
return get(oniSave, path);
}
)(cacheKeyGenerator);
function mapStateToProps(state: AppState, props: EditorFieldProps) {
return {
value: itemValue(state, props)
};
}
export type StateProps = ReturnType;
)
.map(
resourceKey =>
`${getPayloadIdsHash(
state,
normalizedURL,
resourceKey,
)}-${getResourceHash(state, resourceKey)}`,
)
.join('--')}`;
}
return getEmptyResourceHash();
};
const getRequestResource = createCachedSelector(
resourcesSelector,
resourceSelector,
payloadIdsSelector,
applyDenormalizerSelector,
denormalizerSelector,
getRequestResourceSelector,
)(getRequestResourceResolver, getReReselectOptions());
const getRequestMetadata = (state, normalizedURL) =>
state.requests
&& state.requests[normalizedURL]
&& state.requests[normalizedURL].metadata
? state.requests[normalizedURL].metadata
: {};
const isPerformingRequest = (state, normalizedURL) =>
export const getSettings = state => state.settings;
export const getCurrentSettings = state => getSettings(state).current;
export const getCurrentSetting = (state, {setting}) => get(getCurrentSettings(state), setting);
const getCommands = state => state.commands;
const getAstrometryIsDownloading = state => state.settings.astrometry.isDownloading;
export const getServerName = state => get(state, 'settings.current.server_name', '');
export const getAutoguiderEngine = state => get(state, 'settings.current.autoguider_engine', 'off');
const settingSelectorKey = (state, {setting}) => setting;
export const getSettingSelector = createCachedSelector(getCurrentSetting, (currentValue) => ({
currentValue,
}))(settingSelectorKey);
export const getCheckboxSettingSelector = createCachedSelector(getCurrentSetting, (currentValue) => {
const checked = (currentValue || 0) !== 0
return { checked };
})(settingSelectorKey);
export const settingsSelector = createSelector([
getSettings,
getBackendVersion,
getFrontendVersion,
getCommands,
getAstrometryIsDownloading,
getCurrentCatalogs,