Move 'compareId' to comparators utils

redesign-interaction-bar2
Chewbacca 2022-11-15 08:58:55 -05:00
rodzic a202fe68d1
commit db5d0d6400
5 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
import compareId from '../compare_id'; import { compareId } from '../utils/comparators';
test('compareId', () => { test('compareId', () => {
expect(compareId('3', '3')).toBe(0); expect(compareId('3', '3')).toBe(0);

Wyświetl plik

@ -3,9 +3,9 @@ import 'intl-pluralrules';
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import api, { getLinks } from 'soapbox/api'; import api, { getLinks } from 'soapbox/api';
import compareId from 'soapbox/compare_id';
import { getFilters, regexFromFilters } from 'soapbox/selectors'; import { getFilters, regexFromFilters } from 'soapbox/selectors';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth';
import { compareId } from 'soapbox/utils/comparators';
import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features'; import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features';
import { unescapeHTML } from 'soapbox/utils/html'; import { unescapeHTML } from 'soapbox/utils/html';
import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification'; import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification';

Wyświetl plik

@ -4,10 +4,10 @@ import { defineMessages, useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { fetchUsers } from 'soapbox/actions/admin'; import { fetchUsers } from 'soapbox/actions/admin';
import compareId from 'soapbox/compare_id';
import { Widget } from 'soapbox/components/ui'; import { Widget } from 'soapbox/components/ui';
import AccountContainer from 'soapbox/containers/account_container'; import AccountContainer from 'soapbox/containers/account_container';
import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
import { compareId } from 'soapbox/utils/comparators';
const messages = defineMessages({ const messages = defineMessages({
title: { id: 'admin.latest_accounts_panel.title', defaultMessage: 'Latest Accounts' }, title: { id: 'admin.latest_accounts_panel.title', defaultMessage: 'Latest Accounts' },

Wyświetl plik

@ -9,7 +9,7 @@ import {
CONVERSATIONS_UPDATE, CONVERSATIONS_UPDATE,
CONVERSATIONS_READ, CONVERSATIONS_READ,
} from '../actions/conversations'; } from '../actions/conversations';
import compareId from '../compare_id'; import { compareId } from '../utils/comparators';
import type { AnyAction } from 'redux'; import type { AnyAction } from 'redux';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';

Wyświetl plik

@ -9,7 +9,7 @@
* - `1`: id1 > id2 * - `1`: id1 > id2
* - `-1`: id1 < id2 * - `-1`: id1 < id2
*/ */
export default function compareId(id1: string, id2: string) { function compareId(id1: string, id2: string) {
if (id1 === id2) { if (id1 === id2) {
return 0; return 0;
} }
@ -19,3 +19,5 @@ export default function compareId(id1: string, id2: string) {
return id1.length > id2.length ? 1 : -1; return id1.length > id2.length ? 1 : -1;
} }
} }
export { compareId };