(str: string)
| 260 | * Exported for testing |
| 261 | */ |
| 262 | export function _removeLoneSurrogates(str: string): string { |
| 263 | // isWellFormed/toWellFormed are ES2024 (not in our TS lib target), so we feature-detect via Object(). |
| 264 | const strObj: Record<string, Function> = Object(str); |
| 265 | const isWellFormed = strObj['isWellFormed']; |
| 266 | const toWellFormed = strObj['toWellFormed']; |
| 267 | if (typeof isWellFormed === 'function' && typeof toWellFormed === 'function') { |
| 268 | return isWellFormed.call(str) ? str : toWellFormed.call(str); |
| 269 | } |
| 270 | return str; |
| 271 | } |
no test coverage detected