MCPcopy Index your code
hub / github.com/nodejs/node / getStringComparerFactory

Function getStringComparerFactory

test/fixtures/snapshot/typescript.js:2126–2140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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.

Callers 1

typescript.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…