You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
module.exports = 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];
|
|
}
|
|
};
|