Skip to content

Commit 6966ef9

Browse files
Merge pull request #6 from sandstreamdev/fix_object_find
fix: return a value from object find, not an entry
2 parents bebd5b1 + 43956f2 commit 6966ef9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

object/find.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import entries from "./entries.js";
22

3-
export default predicate => xs =>
4-
entries(xs).find(([key, value]) => predicate(value, key, xs));
3+
export default predicate => xs => {
4+
const [, value] =
5+
entries(xs).find(([key, value]) => predicate(value, key, xs)) || [];
6+
7+
return value;
8+
};

0 commit comments

Comments
 (0)