@eeplatform/core 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7238,8 +7238,17 @@ function usePSGCRepo() {
|
|
|
7238
7238
|
}
|
|
7239
7239
|
}
|
|
7240
7240
|
async function getByName({ name, prefix = "", type = "" } = {}) {
|
|
7241
|
-
const
|
|
7242
|
-
const
|
|
7241
|
+
const stopWords = /* @__PURE__ */ new Set(["of", "the"]);
|
|
7242
|
+
const words = name.trim().split(/\s+/).filter((w) => w.length > 2 && !stopWords.has(w.toLowerCase())).map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
7243
|
+
const regex = words.map((w) => `(?=.*${w})`).join("");
|
|
7244
|
+
const query = {
|
|
7245
|
+
name: { $regex: regex, $options: "i" }
|
|
7246
|
+
};
|
|
7247
|
+
const cacheKeyOptions = { type };
|
|
7248
|
+
if (type) {
|
|
7249
|
+
query.type = type;
|
|
7250
|
+
cacheKeyOptions.type = type;
|
|
7251
|
+
}
|
|
7243
7252
|
const _types = ["City", "Mun"];
|
|
7244
7253
|
if (_types.includes(type)) {
|
|
7245
7254
|
query.type = { $in: _types };
|