mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Every camera find_alpr_cameras returns comes from the tile source, which builds it through normalizeAlprNode, so the tags are already one line and capped. Drop the second pass in the tool, its duplicate test and the boundary entry, and the function check normalizeDisplayText never sees.
12 lines
409 B
JavaScript
12 lines
409 B
JavaScript
/** One-line text capped at `maxLength` without splitting a surrogate pair. Still untrusted. */
|
|
export function normalizeDisplayText(value, maxLength = 180) {
|
|
if (value == null || typeof value === 'object') return '';
|
|
return String(value)
|
|
.replace(/[\u0000-\u001f\u007f-\u009f]/g, ' ')
|
|
.replace(/\s+/g, ' ')
|
|
.trim()
|
|
.slice(0, maxLength)
|
|
.replace(/[\uD800-\uDBFF]$/, '')
|
|
.trim();
|
|
}
|