Closed nirsalon closed 7 years ago
That's a good idea, what about the firstWhere
name ?
C# uses First()
, and FirstOrDefault()
which doesn't throw if not found
Java 8 uses findFirst()
Usually function names are either verb
or 'verbNoun', so I'd say something like first
/firstMatch
/findFirst
, but firstWhere
also work.
I think I'll go with firstOrDefault
.
I'll probably implement that with https://github.com/fknop/angular-pipes/issues/40 tonight or tomorrow.
I'm submitting a ... (check one with "x")
Current behavior No pipe returns the first element that matches a condition
Expected behavior A new pipe, similar to 'where', that returns the first element that matches the condition See .NET linq .First() https://msdn.microsoft.com/en-us/library/bb535050(v=vs.110).aspx
What is the motivation / use case for changing the behavior? A more performant pipe than (arr | where:[cond])[0]