MCPcopy
hub / github.com/prisma/prisma / fill

Method fill

helpers/compile/plugins/fill-plugin/fillers/buffer-small.ts:402–424  ·  view source on GitHub ↗
(
    value: string | number | Uint8Array = 0,
    offsetEnc: number | Encoding = 0,
    endEnc: number | Encoding = this.length,
    encoding: Encoding = 'utf-8',
  )

Source from the content-addressed store, hash-verified

400 }
401
402 fill(
403 value: string | number | Uint8Array = 0,
404 offsetEnc: number | Encoding = 0,
405 endEnc: number | Encoding = this.length,
406 encoding: Encoding = 'utf-8',
407 ) {
408 const offset = typeof offsetEnc === 'string' ? 0 : offsetEnc
409 const end = typeof endEnc === 'string' ? this.length : endEnc
410 encoding = typeof offsetEnc === 'string' ? offsetEnc : typeof endEnc === 'string' ? endEnc : encoding
411 value = BufferClass.from(typeof value === 'number' ? [value] : (value ?? []), encoding)
412
413 assertString(encoding, 'encoding')
414 assertUnsigned(offset, 'offset', this.length)
415 assertUnsigned(end, 'end', this.length)
416
417 if (value.length !== 0) {
418 for (let i = offset; i < end; i += value.length) {
419 super.set(value.slice(0, value.length + i >= this.length ? this.length - i : value.length), i)
420 }
421 }
422
423 return this
424 }
425
426 includes(value: string | number | Uint8Array, byteOffset: number | null = null, encoding: Encoding = 'utf-8') {
427 return this.indexOf(value, byteOffset, encoding) !== -1

Callers 7

genBufferFunction · 0.80
bufResetFunction · 0.80
test.tsFile · 0.80
tests.tsFile · 0.80
drawBoxFunction · 0.80
allocMethod · 0.80

Calls 5

assertStringFunction · 0.85
assertUnsignedFunction · 0.85
fromMethod · 0.80
setMethod · 0.80
sliceMethod · 0.45

Tested by 2

genBufferFunction · 0.64
bufResetFunction · 0.64