mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
- remove the unused Nominatim reserve(); spacing tests now measure the actual transport start across processes - start each queued building's 2 s ground-sampling budget when it reaches the head of the queue, and request a frame on promotion - accept Nominatim and grounds outlines that cross the antimeridian - let an unnamed school, university, hospital, cemetery, stadium or zoo area answer a grounds ask whose head noun names that kind, using only the part that holds the point; compare grounds names symmetrically - charge shared OpenFreeMap consumers their own slice and keep the charged budget at the previous 64 MiB - share one place-name fold, point-in-polygon, line stitching and nextTask helper instead of duplicates - exclude Who's On First sources licensed only as "CC BY (equivalent)" or "CC0 (equivalent)"; rebuild the pack from the pinned archives - whole-word neighbourhood alias guard; correct the outline size-limit comment - restore DATA_SOURCES.md table formatting, keeping only real edits - test behaviour instead of private engine fields
35 lines
1018 B
JavaScript
35 lines
1018 B
JavaScript
/** Latin letters that Unicode decomposition does not fold to plain ASCII. */
|
||
const FOLD = {
|
||
ß: 'ss',
|
||
ø: 'o',
|
||
æ: 'ae',
|
||
ł: 'l',
|
||
đ: 'd',
|
||
ı: 'i',
|
||
œ: 'oe',
|
||
þ: 'th',
|
||
};
|
||
|
||
/**
|
||
* Comparable form of a place name, shared by the bundled packs, the
|
||
* OpenFreeMap street and grounds matchers and the Nominatim server: case
|
||
* folded, accents removed from Latin letters only, punctuation and symbols
|
||
* collapsed to single spaces, and a leading "the" dropped. Other scripts keep
|
||
* their marks, so "कुल मार्ग" and "काली मार्ग" stay distinct while "São Paulo",
|
||
* "sao paulo" and "SÃO PAULO!" meet.
|
||
*
|
||
* @param {unknown} value
|
||
* @returns {string}
|
||
*/
|
||
export function foldPlaceName(value) {
|
||
return String(value ?? '')
|
||
.toLowerCase()
|
||
.replace(/[ßøæłđıœþ]/g, (c) => FOLD[c])
|
||
.normalize('NFKD')
|
||
.replace(/(\p{Script=Latin})\p{M}+/gu, '$1')
|
||
.normalize('NFKC')
|
||
.replace(/[^\p{L}\p{M}\p{N}]+/gu, ' ')
|
||
.trim()
|
||
.replace(/^the /, '');
|
||
}
|