@nxtedition/slice
Advanced tools
+5
-0
| import util from 'node:util'; | ||
| export type SliceLike = { | ||
| buffer: Buffer; | ||
| byteOffset: number; | ||
| byteLength: number; | ||
| }; | ||
| export declare class Slice { | ||
@@ -3,0 +8,0 @@ buffer: Buffer; |
+20
-10
@@ -5,2 +5,8 @@ import util from 'node:util' | ||
| export class Slice { | ||
@@ -63,12 +69,2 @@ buffer = EMPTY_BUF | ||
| ) { | ||
| if (target instanceof Slice) { | ||
| if (targetStart === undefined) { | ||
| targetStart = target.byteOffset | ||
| } else { | ||
| targetStart += target.byteOffset | ||
| } | ||
| target = target.buffer | ||
| } | ||
| if (sourceStart === undefined) { | ||
@@ -86,2 +82,16 @@ sourceStart = this.byteOffset | ||
| let targetEnd | ||
| if (target instanceof Slice) { | ||
| targetEnd = target.byteOffset + target.byteLength | ||
| if (targetStart === undefined) { | ||
| targetStart = target.byteOffset | ||
| } else { | ||
| targetStart += target.byteOffset | ||
| } | ||
| target = target.buffer | ||
| sourceEnd = Math.min(sourceEnd, sourceStart + (targetEnd - targetStart)) | ||
| } | ||
| if ( | ||
@@ -88,0 +98,0 @@ sourceStart === targetStart && |
+2
-2
| { | ||
| "name": "@nxtedition/slice", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "type": "module", | ||
@@ -33,3 +33,3 @@ "main": "lib/index.js", | ||
| }, | ||
| "gitHead": "80358629a4abe8d9065ac1d1b92ef378493c2dcb" | ||
| "gitHead": "7c9c7457c885c644c7a1e70ef894d4727ce240d6" | ||
| } |
21176
1.72%354
2.31%