mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
chore(repo): remove dead code and useless tests (#3375)
This commit is contained in:
1 parent
7e177a1c90
commit
1cd62eb661
1391 files changed
+783
-120415
No files matched your search
@@ -5,8 +5,6 @@ import {getCachedListFormatter} from '@pkgs/list_utils/src/ListFormattingCache';
|
||||
import {formatListWithFallback} from '@pkgs/list_utils/src/ListFormattingFallback';
|
||||
import {isIntlListFormatLocaleSupported, isIntlListFormatSupported} from '@pkgs/list_utils/src/ListFormattingSupport';
|
||||
import type {
|
||||
IListFormatter,
|
||||
ListFormatOptions,
|
||||
ListFormatStyle,
|
||||
ListFormatType,
|
||||
ListFormatterConfig,
|
||||
@@ -17,10 +15,6 @@ const DEFAULT_LOCALE = Locales.EN_US;
|
||||
const DEFAULT_LIST_FORMAT_STYLE: ListFormatStyle = 'long';
|
||||
const DEFAULT_LIST_FORMAT_TYPE: ListFormatType = 'conjunction';
|
||||
|
||||
export function isListFormatSupported(): boolean {
|
||||
return isIntlListFormatSupported();
|
||||
}
|
||||
|
||||
function normalizeLocale(locale: string): string {
|
||||
if (!isIntlListFormatLocaleSupported(locale)) {
|
||||
return DEFAULT_LOCALE;
|
||||
@@ -55,7 +49,7 @@ function formatItems(items: ReadonlyArray<string>, config: ResolvedListFormatter
|
||||
if (items.length === 1) {
|
||||
return items[0] ?? '';
|
||||
}
|
||||
if (!isListFormatSupported()) {
|
||||
if (!isIntlListFormatSupported()) {
|
||||
return formatListWithFallback(items, config.type);
|
||||
}
|
||||
return formatWithIntl(items, config);
|
||||
@@ -65,24 +59,3 @@ export function formatListWithConfig(items: ReadonlyArray<string>, config: ListF
|
||||
const resolvedConfig = resolveListFormatterConfig(config);
|
||||
return formatItems(items, resolvedConfig);
|
||||
}
|
||||
|
||||
export function createListFormatter(config: ListFormatterConfig = {}): IListFormatter {
|
||||
const resolvedConfig = resolveListFormatterConfig(config);
|
||||
return {
|
||||
format(items: ReadonlyArray<string>): string {
|
||||
return formatItems(items, resolvedConfig);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function formatList(
|
||||
items: Array<string>,
|
||||
locale: string = DEFAULT_LOCALE,
|
||||
options: ListFormatOptions = {},
|
||||
): string {
|
||||
return formatListWithConfig(items, {
|
||||
locale,
|
||||
style: options.style,
|
||||
type: options.type,
|
||||
});
|
||||
}
|
||||
@@ -17,7 +17,3 @@ export interface ResolvedListFormatterConfig {
|
||||
style: ListFormatStyle;
|
||||
type: ListFormatType;
|
||||
}
|
||||
|
||||
export interface IListFormatter {
|
||||
format(items: ReadonlyArray<string>): string;
|
||||
}
|
||||
Reference in new issue
Block a user