| 993 | } |
| 994 | |
| 995 | function buildCompareOptionsFromConfig( |
| 996 | config: CollectionConfig<any, any, any>, |
| 997 | ): StringCollationConfig { |
| 998 | if (config.defaultStringCollation) { |
| 999 | const options = config.defaultStringCollation |
| 1000 | return { |
| 1001 | stringSort: options.stringSort ?? `locale`, |
| 1002 | locale: options.stringSort === `locale` ? options.locale : undefined, |
| 1003 | localeOptions: |
| 1004 | options.stringSort === `locale` ? options.localeOptions : undefined, |
| 1005 | } |
| 1006 | } else { |
| 1007 | return { |
| 1008 | stringSort: `locale`, |
| 1009 | } |
| 1010 | } |
| 1011 | } |