Hello Typescript!

This commit is contained in:
undefined committed 2020-07-07 19:58:21 +08:00
1 parent c9b6412527
commit ba03d7a7bf
98 files changed
+3186 -2616

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
function* ranked(diter, equ = (a, b) => a === b) {
let last = null;
let r = 0;
let count = 0;
for (const doc of diter) {
count++;
if (count === 1 || !equ(last, doc)) r = count;
last = doc;
yield [r, doc];
}
}
global.Hydro.lib.rank = ranked;
export default ranked;