bl 1.2.0 → 1.2.1
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.
- package/bl.js +3 -3
- package/package.json +1 -1
- package/test/test.js +2 -0
package/bl.js
CHANGED
|
@@ -200,14 +200,14 @@ BufferList.prototype.shallowSlice = function shallowSlice (start, end) {
|
|
|
200
200
|
, endOffset = this._offset(end)
|
|
201
201
|
, buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)
|
|
202
202
|
|
|
203
|
-
if (startOffset[1] != 0)
|
|
204
|
-
buffers[0] = buffers[0].slice(startOffset[1])
|
|
205
|
-
|
|
206
203
|
if (endOffset[1] == 0)
|
|
207
204
|
buffers.pop()
|
|
208
205
|
else
|
|
209
206
|
buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1])
|
|
210
207
|
|
|
208
|
+
if (startOffset[1] != 0)
|
|
209
|
+
buffers[0] = buffers[0].slice(startOffset[1])
|
|
210
|
+
|
|
211
211
|
return new BufferList(buffers)
|
|
212
212
|
}
|
|
213
213
|
|
package/package.json
CHANGED
package/test/test.js
CHANGED
|
@@ -560,9 +560,11 @@ tape('shallow slice across buffer boundaries', function (t) {
|
|
|
560
560
|
})
|
|
561
561
|
|
|
562
562
|
tape('shallow slice within single buffer', function (t) {
|
|
563
|
+
t.plan(2)
|
|
563
564
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
|
564
565
|
|
|
565
566
|
t.equal(bl.shallowSlice(5, 10).toString(), 'Secon')
|
|
567
|
+
t.equal(bl.shallowSlice(7, 10).toString(), 'con')
|
|
566
568
|
t.end()
|
|
567
569
|
})
|
|
568
570
|
|