Should `findSingle` has the default predicate?
See original GitHub issuefindSingle
in collections
module has the default selector predicate of (_) => true
. Does this make sense? What’s the use case?
context of this discussion: https://github.com/denoland/deno_std/pull/1166#issuecomment-917268388
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
c# - Among Find, Single, First, which one is the fastest?
Find is actually closer to FirstOrDefault, as Find will return the default if no match is found. First will throw an exception. Single:...
Read more >TypeScript Type Guards and Type Predicates
A type guard is an expression that performs a runtime check that guarantees the type in the current scope. The quick fix is...
Read more >Java 8 Stream filter() + findFirst Example Tutorial
You can use the Stream class along with filter() and findFirst() methods to find out an element based upon a Predicate, a functional...
Read more >Automatically Generating Predicates and Solutions for ...
We followed three goals in designing our automated predicate extraction system. 3.1 Minimize false positives. Automatically inferring user intentions is a hard ...
Read more >List<T>.Find(Predicate<T>) Method
If the default value satisfies the search predicate, use the FindIndex method instead. This method performs a linear search; therefore, this method is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just for completeness here the reasons why I find we should remove the default predicate
findSingle
corresponds tofind
andfindIndex
which have a mandatory predicate.@kt3k I think this issue can be closed since the PR got merged.