(this: CollatorType)
| 168 | Object.defineProperty(Collator.prototype, 'compare', { |
| 169 | configurable: true, |
| 170 | get(this: CollatorType) { |
| 171 | if ( |
| 172 | typeof this !== 'object' || |
| 173 | !OrdinaryHasInstance(Collator, this) |
| 174 | ) { |
| 175 | throw TypeError( |
| 176 | 'Intl.Collator compare property accessor called on incompatible receiver' |
| 177 | ) |
| 178 | } |
| 179 | const collator = this |
| 180 | const internalSlots = getInternalSlots(collator) |
| 181 | let boundCompare = internalSlots.boundCompare |
| 182 | if (boundCompare === undefined) { |
| 183 | // Collator Compare Functions convert both arguments with ToString and |
| 184 | // then call CompareStrings. The getter caches the bound compare function |
| 185 | // in the collator internal slots. |
| 186 | // https://tc39.es/ecma402/#sec-collator-comparefunctions |
| 187 | boundCompare = (x: string, y: string) => |
| 188 | compareCollatorStrings(internalSlots, String(x), String(y)) |
| 189 | internalSlots.boundCompare = boundCompare |
| 190 | } |
| 191 | return boundCompare |
| 192 | }, |
| 193 | }) |
| 194 | |
| 195 | Object.defineProperty(Collator.prototype, 'resolvedOptions', { |
nothing calls this directly
no test coverage detected