1
>
/*---------------------------------------------------------------------------------------------
comparers.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { safeIntl } from './date.js';
7
>
import { Lazy } from './lazy.js';
8
>
import { sep } from './path.js';
9
>
10
>
// When comparing large numbers of strings it's better for performance to create an
11
>
// Intl.Collator object and use the function provided by its compare property
12
>
// than it is to use String.prototype.localeCompare()
13
>
14
>
// A collator with numeric sorting enabled, and no sensitivity to case, accents or diacritics.
15
>
const intlFileNameCollatorBaseNumeric: Lazy<{ collator: Intl.Collator; collatorIsNumeric: boolean }> = new Lazy(() => {
16
const collator = safeIntl.Collator(undefined, { numeric: true, sensitivity: 'base' }).value;
17
return {