From c138752a6c1d010dab035380cf6e7125b5966dec Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Wed, 20 Nov 2024 10:09:02 -0500 Subject: [PATCH] Rewrite hasOsfmapValue based on earlier suggestion --- app/packages/osfmap/jsonld.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/packages/osfmap/jsonld.ts b/app/packages/osfmap/jsonld.ts index bba174ec419..9711ea177ca 100644 --- a/app/packages/osfmap/jsonld.ts +++ b/app/packages/osfmap/jsonld.ts @@ -33,11 +33,5 @@ export function getSingleOsfmapObject(osfmapObject: any, propertyPath: string[]) } export function hasOsfmapValue(osfmapObject: any, propertyPath: string[], expectedValue: any) { - // could use `Iterator.prototype.some()` instead, if polyfilled - for (const value of iterOsfmapValues(osfmapObject, propertyPath)) { - if (value === expectedValue) { - return true; - } - } - return false; + return Array.from(iterOsfmapValues(osfmapObject, propertyPath)).some(value => value === expectedValue); }