()
| 2124 | } |
| 2125 | } |
| 2126 | function getStringComparerFactory() { |
| 2127 | // If the host supports Intl, we use it for comparisons using the default locale. |
| 2128 | if (typeof Intl === "object" && typeof Intl.Collator === "function") { |
| 2129 | return createIntlCollatorStringComparer; |
| 2130 | } |
| 2131 | // If the host does not support Intl, we fall back to localeCompare. |
| 2132 | // localeCompare in Node v0.10 is just an ordinal comparison, so don't use it. |
| 2133 | if (typeof String.prototype.localeCompare === "function" && |
| 2134 | typeof String.prototype.toLocaleUpperCase === "function" && |
| 2135 | "a".localeCompare("B") < 0) { |
| 2136 | return createLocaleCompareStringComparer; |
| 2137 | } |
| 2138 | // Otherwise, fall back to ordinal comparison: |
| 2139 | return createFallbackStringComparer; |
| 2140 | } |
| 2141 | function createStringComparer(locale) { |
| 2142 | // Hold onto common string comparers. This avoids constantly reallocating comparers during |
| 2143 | // tests. |
no outgoing calls
no test coverage detected
searching dependent graphs…