@nxtedition/slice 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +7 -1
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -209,7 +209,13 @@ export class Slice {
209
209
  offset += this.byteOffset
210
210
  }
211
211
 
212
- source.copy(this.buffer, offset)
212
+ const available = this.byteOffset + this.byteLength - offset
213
+ if (available <= 0) {
214
+ return
215
+ }
216
+
217
+ const end = source.byteLength < available ? source.byteLength : available
218
+ source.copy(this.buffer, offset, 0, end)
213
219
  }
214
220
 
215
221
  at(index ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/slice",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -30,5 +30,5 @@
30
30
  "tsd": "^0.33.0",
31
31
  "typescript": "^5.9.3"
32
32
  },
33
- "gitHead": "b3ff34d7bea69e295919bdfdae8bc2e6ff9ab0ff"
33
+ "gitHead": "472a4cdfd11ff9f1a7dcf8b81599bc1d9270bc90"
34
34
  }