13 lines
246 B
JavaScript
13 lines
246 B
JavaScript
function findKey(map, doesMatch) {
|
|
let result = undefined;
|
|
for (const [key, value] of map) {
|
|
if (doesMatch(value, key, map)) {
|
|
result = key;
|
|
break;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
export { findKey };
|