Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// in the cemetery and continue processing ids.
if (j === metadata.ids.length || metadata.ids[j] !== ids[i]) {
let count = metadata.cemetery[ids[i]] || 0;
metadata.cemetery[ids[i]] = count + 1;
i++
continue;
}
// Set up the chunk index.
let index = j;
// Set up the chunk count.
let count = 0;
// Find the extent of the chunk.
while (i < n && StringExt.cmp(ids[i], metadata.ids[j]) === 0) {
count++;
i++;
j++;
}
// Add the chunk to the chunks array, or bump the id index.
if (count > 0) {
chunks.push({ index, count });
} else {
i++;
}
}
// Return the computed chunks.
return chunks;
}
// in the cemetery and continue processing ids.
if (j === metadata.ids.length || metadata.ids[j] !== ids[i]) {
let count = metadata.cemetery[ids[i]] || 0;
metadata.cemetery[ids[i]] = count + 1;
i++;
continue;
}
// Set up the chunk index.
let index = j;
// Set up the chunk count.
let count = 0;
// Find the extent of the chunk.
while (i < n && StringExt.cmp(ids[i], metadata.ids[j]) === 0) {
count++;
i++;
j++;
}
// Add the chunk to the chunks array, or bump the id index.
if (count > 0) {
chunks.push({ index, count });
} else {
i++;
}
}
// Return the computed chunks.
return chunks;
}
function recordIdCmp<s>(record: Record<s>, id: string): number {
return StringExt.cmp(record.$id, id);
}
</s></s>
function recordCmp<s>(a: Record<s>, b: Record<s>): number {
return StringExt.cmp(a.$id, b.$id);
}
</s></s></s>
function recordCmp<s>(a: Table<s>, b: Table<s>): number {
return StringExt.cmp(a.schema.id, b.schema.id);
}
</s></s></s>
function recordIdCmp<s>(table: Table<s>, id: string): number {
return StringExt.cmp(table.schema.id, id);
}
</s></s>