openings 0.1.9 → 0.1.11
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/.codex-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/src/locations.ts +4 -1
- package/src/version.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openings",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Find evidence-grounded jobs, including relevant roles you may not have searched for, without accounts or API keys.",
|
|
5
5
|
"author": { "name": "Openings contributors" },
|
|
6
6
|
"license": "MIT",
|
package/package.json
CHANGED
package/src/locations.ts
CHANGED
|
@@ -104,6 +104,8 @@ function detectRegions(location: string, description: string): string[] {
|
|
|
104
104
|
/** US state and district postal codes. Many collide with ISO country codes (IN, CA, DE, CO, GA, ID, IL, LA, MA, MD, MO, MT, NE, PA, SC, SD, TN, VA). */
|
|
105
105
|
const US_STATE_CODES = new Set(["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY", "DC"]);
|
|
106
106
|
const US_CITY_STATE = /,\s*([A-Z]{2})(?=\s*(?:$|,|\d{5}|\(|\/|-))/g;
|
|
107
|
+
/** Workday's "ST-CITY, street" and "ST - City" shapes, e.g. "IN-INDIANAPOLIS, 220 VIRGINIA AVE" or "IN - Indianapolis". */
|
|
108
|
+
const US_STATE_PREFIX = /^([A-Z]{2})\s*-\s*(?=[A-Za-z])/;
|
|
107
109
|
|
|
108
110
|
function detectCountries(location: string): string[] {
|
|
109
111
|
const byName: string[] = [];
|
|
@@ -115,7 +117,8 @@ function detectCountries(location: string): string[] {
|
|
|
115
117
|
// "Indianapolis, IN" is Indiana, not India: a bare code in the US "City, ST" position is a state unless a country name
|
|
116
118
|
// or a known Indian place says otherwise.
|
|
117
119
|
// Case matters: "Berlin, de" is a lowercase country code, "Gary, IN" is a state.
|
|
118
|
-
const
|
|
120
|
+
const prefix = US_STATE_PREFIX.exec(location)?.[1];
|
|
121
|
+
const stateCodes = [...[...location.matchAll(US_CITY_STATE)].map((match) => match[1]!), ...(prefix ? [prefix] : [])].filter((code) => US_STATE_CODES.has(code));
|
|
119
122
|
if (stateCodes.length && byName.length === 0 && !INDIA_PATTERN.test(location)) {
|
|
120
123
|
return [...new Set(["US", ...byCode.filter((code) => !US_STATE_CODES.has(code))])];
|
|
121
124
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.11";
|