gdc-common-utils-ts 1.4.16 → 1.4.18
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.
|
@@ -40,9 +40,18 @@ export function extractRepresentativeRoleCode(representativeCredential) {
|
|
|
40
40
|
return occupation.trim() || undefined;
|
|
41
41
|
if (occupation && typeof occupation === 'object') {
|
|
42
42
|
const occ = occupation;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
43
|
+
const idRaw = occ.identifier;
|
|
44
|
+
if (typeof idRaw === 'string' && idRaw.trim())
|
|
45
|
+
return idRaw.trim();
|
|
46
|
+
if (idRaw && typeof idRaw === 'object') {
|
|
47
|
+
const idObj = idRaw;
|
|
48
|
+
const idValue = String(idObj.value || '').trim();
|
|
49
|
+
if (idValue)
|
|
50
|
+
return idValue;
|
|
51
|
+
}
|
|
52
|
+
const idValue = String(occ.value || '').trim();
|
|
53
|
+
if (idValue)
|
|
54
|
+
return idValue;
|
|
46
55
|
const name = String(occ.name || '').trim();
|
|
47
56
|
if (name)
|
|
48
57
|
return name;
|
|
@@ -50,7 +59,11 @@ export function extractRepresentativeRoleCode(representativeCredential) {
|
|
|
50
59
|
return undefined;
|
|
51
60
|
}
|
|
52
61
|
export function hasRoleCode(roleCode, requiredCode = 'RESPRSN') {
|
|
53
|
-
const normalizedRole = String(roleCode || '')
|
|
62
|
+
const normalizedRole = String(roleCode || '')
|
|
63
|
+
.trim()
|
|
64
|
+
.toUpperCase()
|
|
65
|
+
.replace(/^.*\|/, '')
|
|
66
|
+
.replace(/^[|:]+/, '');
|
|
54
67
|
const normalizedRequired = String(requiredCode || '').trim().toUpperCase();
|
|
55
68
|
return normalizedRole.includes(normalizedRequired);
|
|
56
69
|
}
|