From 79550750b3b3820560e4f7385067788534e4d417 Mon Sep 17 00:00:00 2001 From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:27:01 -0500 Subject: [PATCH] Rewrite hasOsfmapValue based on earlier suggestion (#2407) --- 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); }