# string-locale-compare **Repository Path**: mirrors_isaacs/string-locale-compare ## Basic Information - **Project Name**: string-locale-compare - **Description**: Compare strings with Intl.Collator if available, falling back to String.localeCompare otherwise - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-22 - **Last Updated**: 2025-12-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # @isaacs/string-locale-compare Compare strings with Intl.Collator if available, falling back to String.localeCompare otherwise. This also forces the use of a specific locale, to avoid using the system locale, which is non-deterministic. ## USAGE ```js const stringLocaleCompare = require('@isaacs/string-locale-compare') myArrayOfStrings.sort(stringLocaleCompare('en')) // can also pass extra options myArrayOfNumericStrings.sort(stringLocaleCompare('en', { numeric: true })) ``` ## API `stringLocaleCompare(locale, [options])` Locale is required, must be a valid locale string. Options is optional. The following options are supported: * `sensitivity` * `numeric` * `ignorePunctuation` * `caseFirst`