mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-14 15:22:21 +00:00
docs: tighten the display-text notes
Name routeId among the canonical analyst IDs in CURRENT-STATE, say what the changelog entry changes for users, and drop the comment that repeated the canonical-field doc.
This commit is contained in:
1 parent
3521c96172
commit
12a5630991
4 files changed
+15
-18
No files matched your search
@@ -1,4 +1,4 @@
|
||||
/** Bounded, single-line external display text; it remains untrusted source data. */
|
||||
/** 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' || typeof value === 'function')
|
||||
return '';
|
||||
|
||||
@@ -5353,9 +5353,9 @@ const ANALYST_IDENTITY_FIELDS = Object.freeze([
|
||||
]);
|
||||
|
||||
/**
|
||||
* Analyst item keys that identify a record rather than describe it: the
|
||||
* referent registry, track_entity and locateLayerEntity match on them, so
|
||||
* display-text normalization must leave them byte-for-byte unchanged.
|
||||
* Keys that identify an analyst record. The referent registry, track_entity,
|
||||
* locateLayerEntity and follow-up filters match on them, so they skip
|
||||
* display-text normalization.
|
||||
*/
|
||||
const ANALYST_CANONICAL_FIELDS = new Set([
|
||||
'layerKey',
|
||||
@@ -5405,9 +5405,7 @@ function compactAnalystItem(r) {
|
||||
} else compact[key] = r[key];
|
||||
}
|
||||
if (present(r.ageHours)) compact.ageHours = r.ageHours;
|
||||
// Display text only: canonical keys are lookup identities (bikeshare uses
|
||||
// the raw station name as its id), so the referent registry and
|
||||
// locateLayerEntity must see them exactly as the layer reports them.
|
||||
// Canonical keys stay raw: bikeshare's id is the raw station name.
|
||||
for (const key of Object.keys(compact)) {
|
||||
if (typeof compact[key] === 'string' && !ANALYST_CANONICAL_FIELDS.has(key))
|
||||
compact[key] = normalizeDisplayText(compact[key]);
|
||||
|
||||
Reference in new issue
Block a user