Socket
Socket
Sign inDemoInstall

split

Package Overview
Dependencies
1
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.6 to 0.2.7

test/partitioned_unicode.js

12

index.js

@@ -9,4 +9,4 @@ //filter will reemit the data if cb(err,pass) pass is truthy

var through = require('through')
var Decoder = require('string_decoder').StringDecoder
module.exports = split

@@ -17,2 +17,3 @@

function split (matcher, mapper) {
var decoder = new Decoder()
var soFar = ''

@@ -39,3 +40,3 @@ if('function' === typeof matcher)

return through(function (buffer) {
function next (stream, buffer) {
var pieces = (soFar + buffer).split(matcher)

@@ -46,6 +47,11 @@ soFar = pieces.pop()

var piece = pieces[i]
emit(this, piece)
emit(stream, piece)
}
}
return through(function (b) {
next(this, decoder.write(b))
},
function () {
next(this, decoder.end())
if(soFar != null)

@@ -52,0 +58,0 @@ emit(this, soFar)

{
"name": "split",
"version": "0.2.6",
"version": "0.2.7",
"description": "split a Text Stream into a Line Stream",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/dominictarr/split",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc