linter fix

This commit is contained in:
Kristaps Fabians Geikins
2024-10-17 16:56:26 +03:00
parent 4aac3670c2
commit 4a7d49bb55
@@ -23,15 +23,15 @@ export const estimateStringByteSize = (str: string) => str.length
export const estimateStringMegabyteSize = (str: string) =>
estimateStringByteSize(str) / 1_000_000
export const chunkInsertionObjectArray = ({
export const chunkInsertionObjectArray = <O extends InsertionObject = InsertionObject>({
objects,
chunkSizeLimitMb,
chunkLengthLimit
}: {
chunkSizeLimitMb: number
chunkLengthLimit: number
objects: InsertionObject[]
}): InsertionObject[][] => {
objects: O[]
}): O[][] => {
if (chunkLengthLimit < 1)
throw new ArgumentError('Chunks must have a length limit > 1')
if (chunkSizeLimitMb <= 0)
@@ -39,8 +39,8 @@ export const chunkInsertionObjectArray = ({
let currentChunkSize = 0
let currentChunkLength = 0
const chunkedObjects: InsertionObject[][] = []
let currentBatch: InsertionObject[] = []
const chunkedObjects: O[][] = []
let currentBatch: O[] = []
for (const obj of objects) {
// if limits are exceeded start a new batch
if (