@vbarbarosh/node-helpers 3.17.0 → 3.17.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/package.json
CHANGED
package/src/stream_strpbrk.js
CHANGED
|
@@ -8,10 +8,10 @@ function stream_strpbrk(chars = '\r\n')
|
|
|
8
8
|
const pending = [];
|
|
9
9
|
return new stream.Transform({
|
|
10
10
|
objectMode: true,
|
|
11
|
-
decodeStrings: true,
|
|
12
11
|
transform: function (str, encoding, next) {
|
|
13
|
-
|
|
12
|
+
str = Buffer.isBuffer(str) ? str.toString() : str;
|
|
14
13
|
|
|
14
|
+
for (let off = 0; off < str.length; ) {
|
|
15
15
|
// skip consecutive delimiters
|
|
16
16
|
while (off < str.length) {
|
|
17
17
|
let stop = true;
|
|
@@ -14,6 +14,8 @@ const items = [
|
|
|
14
14
|
['a|||b → a,b', '|', ['a|||b'], ['a', 'b']],
|
|
15
15
|
['abc → abc', '|', ['a', 'b', 'c'], ['abc']],
|
|
16
16
|
['a|b;c', '|;', ['a|b;c'], ['a', 'b', 'c']],
|
|
17
|
+
['Buffer(a) → a', '|', ['a'].map(Buffer.from), ['a']],
|
|
18
|
+
['Buffer(a|b) → a,b', '|', ['a|b'].map(Buffer.from), ['a', 'b']],
|
|
17
19
|
];
|
|
18
20
|
|
|
19
21
|
describe('stream_strpbrk', function () {
|