Remove customReplacer

This commit is contained in:
IshaVenikar 2024-07-29 19:04:22 +05:30 committed by Nabarun
parent 8fa331a07a
commit b10c718cde

View File

@ -38,17 +38,6 @@ function getApplicantDetails (applicantId: string | number) {
return config; return config;
} }
function customReplacer(key: string, value: any): any {
if (key === 'requiredIdDocs' && typeof value === 'object' && value !== null) {
const containsArray = Object.values(value).some(Array.isArray);
if (containsArray) {
return undefined; // Exclude this key because the includedCountries and docSets data is not required
}
}
return value;
}
export const handler = async (argv: Arguments) => { export const handler = async (argv: Arguments) => {
const applicantId = argv.applicantId as string; const applicantId = argv.applicantId as string;
@ -58,7 +47,11 @@ export const handler = async (argv: Arguments) => {
try { try {
const response = await sumsubAxios(getApplicantDetails(applicantId)); const response = await sumsubAxios(getApplicantDetails(applicantId));
console.log('Applicant Data:', JSON.stringify(response.data, customReplacer, 1));
// Exclude this key because the includedCountries and docSets data is not required
delete response.data.requiredIdDocs;
console.log('Applicant Data:', JSON.stringify(response.data, null, 2));
} catch (error: any) { } catch (error: any) {
console.error('Failed to fetch applicant data:', error.response ? error.response.data : error.message); console.error('Failed to fetch applicant data:', error.response ? error.response.data : error.message);
} }