From 872749eb4535297cebbe217036a0a119c16c3c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20A=CC=8Ahsberg?= Date: Fri, 26 Mar 2021 10:33:06 +0000 Subject: [PATCH] Fix unnecessary type casts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathias Åhsberg --- .../src/ingestion/processors/ldap/vendors.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/catalog-backend/src/ingestion/processors/ldap/vendors.ts b/plugins/catalog-backend/src/ingestion/processors/ldap/vendors.ts index 0441a2c3e7..a7ae9fc65f 100644 --- a/plugins/catalog-backend/src/ingestion/processors/ldap/vendors.ts +++ b/plugins/catalog-backend/src/ingestion/processors/ldap/vendors.ts @@ -69,7 +69,7 @@ function decode( ): string[] { const values = entry.raw[attributeName]; if (Array.isArray(values)) { - return (values as Buffer[]).map(v => { + return values.map(v => { return decoder(v); }); } else if (values) { @@ -80,8 +80,8 @@ function decode( // Formats a Microsoft Active Directory binary-encoded uuid to a readable string // See https://github.com/ldapjs/node-ldapjs/issues/297#issuecomment-137765214 -function formatGUID(objectGUID: string | Buffer | Buffer[]): string { - let data: Buffer | Buffer[]; +function formatGUID(objectGUID: string | Buffer): string { + let data: Buffer; if (typeof objectGUID === 'string') { data = new Buffer(objectGUID, 'binary'); } else { @@ -97,7 +97,7 @@ function formatGUID(objectGUID: string | Buffer | Buffer[]): string { dataStr = data[i] >= 16 ? dataStr : `0${dataStr}`; // insert that character into the template - template = template.replace(new RegExp(`\\{${i}\\}`, 'g'), dataStr); + template = template.replace(`{${i}}`, dataStr); } return template; }