Created
June 2, 2022 01:48
-
-
Save fasiha/c93359e57b38351037ba1c0c595b2654 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filteredLengthAtLeast<T>( | |
v: T[], | |
filter: (x: T) => boolean, | |
min: number, | |
) { | |
let nfound = 0; | |
for (let i = 0; i < v.length, nfound < min; i++) { | |
nfound += +filter(v[i]); | |
} | |
return nfound >= min; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment