Skip to content

Commit

Permalink
Rewrite hasOsfmapValue based on earlier suggestion (#2407)
Browse files Browse the repository at this point in the history
  • Loading branch information
futa-ikeda authored Nov 20, 2024
1 parent 684c877 commit 7955075
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions app/packages/osfmap/jsonld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 7955075

Please sign in to comment.