jd-intel 0.3.1 → 0.3.2
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/package.json +1 -1
- package/src/normalizer.js +6 -3
package/package.json
CHANGED
package/src/normalizer.js
CHANGED
|
@@ -3,8 +3,11 @@ import { createHash } from 'node:crypto';
|
|
|
3
3
|
/**
|
|
4
4
|
* Generate a stable ID for a job posting.
|
|
5
5
|
*/
|
|
6
|
-
export function jobId(company, title, ats) {
|
|
7
|
-
|
|
6
|
+
export function jobId(company, title, ats, location = '') {
|
|
7
|
+
// Location is part of identity: the same role posted in multiple
|
|
8
|
+
// offices is distinct requisitions with distinct URLs. Omitting it
|
|
9
|
+
// collapsed multi-office postings to one id (see issue #17).
|
|
10
|
+
const raw = `${company}|${title}|${ats}|${location}`.toLowerCase().trim();
|
|
8
11
|
return createHash('md5').update(raw).digest('hex').substring(0, 12);
|
|
9
12
|
}
|
|
10
13
|
|
|
@@ -14,7 +17,7 @@ export function jobId(company, title, ats) {
|
|
|
14
17
|
export function normalize(raw, ats) {
|
|
15
18
|
const now = new Date().toISOString();
|
|
16
19
|
return {
|
|
17
|
-
id: jobId(raw.company || raw.companySlug, raw.title, ats),
|
|
20
|
+
id: jobId(raw.company || raw.companySlug, raw.title, ats, raw.location || ''),
|
|
18
21
|
company: raw.company || raw.companySlug || '',
|
|
19
22
|
companySlug: raw.companySlug || '',
|
|
20
23
|
ats,
|