split2
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -98,3 +98,3 @@ /* | ||
// If options is only argument. | ||
} else if (typeof matcher === 'object' && !(matcher instanceof RegExp)) { | ||
} else if (typeof matcher === 'object' && !(matcher instanceof RegExp) && !matcher[Symbol.split]) { | ||
options = matcher | ||
@@ -101,0 +101,0 @@ matcher = /\r?\n/ |
{ | ||
"name": "split2", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "split a Text Stream into a Line Stream, using Stream 3", | ||
@@ -36,5 +36,5 @@ "main": "index.js", | ||
"pre-commit": "^1.1.2", | ||
"standard": "^16.0.1", | ||
"standard": "^17.0.0", | ||
"tape": "^5.0.0" | ||
} | ||
} |
@@ -63,3 +63,3 @@ # Split2(matcher, mapper, options) | ||
}) | ||
.on("error", function(error) => { | ||
.on("error", function(error) { | ||
//handling parsing errors | ||
@@ -66,0 +66,0 @@ }) |
17
test.js
@@ -393,1 +393,18 @@ 'use strict' | ||
}) | ||
test('supports Symbol.split', function (t) { | ||
t.plan(2) | ||
const input = split({ | ||
[Symbol.split] (str) { | ||
return str.split('~') | ||
} | ||
}) | ||
input.pipe(strcb(function (err, list) { | ||
t.error(err) | ||
t.deepEqual(list, ['hello', 'world']) | ||
})) | ||
input.end('hello~world') | ||
}) |
17419
440