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

Make admin crypto address tickers more forgiving

See merge request soapbox-pub/soapbox-fe!576
This commit is contained in:
Alex Gleason 2021-07-03 00:05:46 +00:00
commit a184ee5feb
1 changed files with 10 additions and 1 deletions

View File

@ -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),
);
};