Merge branch 'crypto-ticker-forgiving' into 'develop'

Make admin crypto address tickers more forgiving

See merge request soapbox-pub/soapbox-fe!576
merge-requests/577/head
Alex Gleason 2021-07-03 00:05:46 +00:00
commit a184ee5feb
1 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -5,11 +5,20 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import CryptoAddress from './crypto_address';
import { createSelector } from 'reselect';
import { trimStart } from 'lodash';
const normalizeAddress = address => {
return address.update('ticker', '', ticker => {
return trimStart(ticker, '$').toLowerCase();
});
};
const normalizeAddresses = addresses => addresses.map(normalizeAddress);
const makeGetCoinList = () => {
return createSelector(
[(addresses, limit) => typeof limit === 'number' ? addresses.take(limit) : addresses],
addresses => addresses,
addresses => normalizeAddresses(addresses),
);
};