INFRA-3970 | Dhruv | change safeArrayAccess to safeMapAccess
This commit is contained in:
@@ -165,7 +165,9 @@ const safeMapAccess = (preManifestObject, key) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const safeArrayAccess = (array, identifier: number | string) => {
|
const safeArrayAccess = (array, identifier: number | string) => {
|
||||||
if (!Array.isArray(array)) return undefined;
|
if (!Array.isArray(array)) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
if (typeof identifier === 'number') {
|
if (typeof identifier === 'number') {
|
||||||
return array[identifier];
|
return array[identifier];
|
||||||
} else if (typeof identifier === 'string') {
|
} else if (typeof identifier === 'string') {
|
||||||
@@ -235,7 +237,7 @@ const getBreachedLimits = (
|
|||||||
value: currentManifestObj,
|
value: currentManifestObj,
|
||||||
};
|
};
|
||||||
if (replaceWithPreviousValue) {
|
if (replaceWithPreviousValue) {
|
||||||
manifestObject[key] = safeArrayAccess(preManifestObject, key);
|
manifestObject[key] = safeMapAccess(preManifestObject, key);
|
||||||
}
|
}
|
||||||
breaches = breaches.concat(obj);
|
breaches = breaches.concat(obj);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user