[object Object]

← back to Commercialrealestate

CRCP scope: sameCity strips trailing state suffix ('City, CA') before norm so standard City,ST data still scopes (was silent under-scope)

c56a9933a23a3c27f3e1fa4f039ff4328b0aec38 · 2026-08-20 14:20:30 -0700 · Steve

Files touched

Diff

commit c56a9933a23a3c27f3e1fa4f039ff4328b0aec38
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Aug 20 14:20:30 2026 -0700

    CRCP scope: sameCity strips trailing state suffix ('City, CA') before norm so standard City,ST data still scopes (was silent under-scope)
---
 public/crcp-cities.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/public/crcp-cities.js b/public/crcp-cities.js
index 09382b3..f7ada3b 100644
--- a/public/crcp-cities.js
+++ b/public/crcp-cities.js
@@ -45,8 +45,11 @@
     if (!label0 || RESERVED[label0] || /^\d+$/.test(label0)) return null;
     return BY_SLUG[label0] || null;
   }
-  // Does a listing's city string belong to this city object?
-  function sameCity(cityStr, cityObj) { return !!cityObj && norm(cityStr) === cityObj.norm; }
+  // Does a listing's city string belong to this city object? Strip a trailing state suffix
+  // ("Pacific Palisades, CA" -> "Pacific Palisades") BEFORE norm — norm() removes non-letters,
+  // so without this a standard "City, ST" data source would norm to "pacificpalisadesca" and
+  // silently miss the match (under-scoping). split guards null via the String() coercion.
+  function sameCity(cityStr, cityObj) { return !!cityObj && norm(String(cityStr == null ? "" : cityStr).split(",")[0]) === cityObj.norm; }
 
   window.CRCP_CITIES = {
     LABELS: LABELS, SLUGS: SLUGS, CITIES: CITIES, BY_SLUG: BY_SLUG, FIRE: FIRE, FIRE_CITIES: FIRE_CITIES,

← 22ec0ea auto-data-snapshot: 2026-08-20T14:07:04 (2 data files) — pac  ·  back to Commercialrealestate  ·  CRCP: inline-city SSO — one hub login reaches all cities inl c4ea663 →