Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@serialport/parser-delimiter

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serialport/parser-delimiter - npm Package Compare versions

Comparing version 1.0.5 to 2.0.1

CHANGELOG.md

19

delimiter.js

@@ -1,3 +0,1 @@

'use strict'
const Buffer = require('safe-buffer').Buffer
const Transform = require('stream').Transform

@@ -17,4 +15,3 @@

class DelimiterParser extends Transform {
constructor (options) {
options = options || {}
constructor(options = {}) {
super(options)

@@ -30,3 +27,4 @@

this.includeDelimiter = options.includeDelimiter !== undefined ? options.includeDelimiter : false
this.includeDelimiter =
options.includeDelimiter !== undefined ? options.includeDelimiter : false
this.delimiter = Buffer.from(options.delimiter)

@@ -36,7 +34,12 @@ this.buffer = Buffer.alloc(0)

_transform (chunk, encoding, cb) {
_transform(chunk, encoding, cb) {
let data = Buffer.concat([this.buffer, chunk])
let position
while ((position = data.indexOf(this.delimiter)) !== -1) {
this.push(data.slice(0, position + (this.includeDelimiter ? this.delimiter.length : 0)))
this.push(
data.slice(
0,
position + (this.includeDelimiter ? this.delimiter.length : 0)
)
)
data = data.slice(position + this.delimiter.length)

@@ -48,3 +51,3 @@ }

_flush (cb) {
_flush(cb) {
this.push(this.buffer)

@@ -51,0 +54,0 @@ this.buffer = Buffer.alloc(0)

{
"name": "@serialport/parser-delimiter",
"main": "delimiter.js",
"version": "1.0.5",
"dependencies": {
"safe-buffer": "^5.1.1"
"version": "2.0.1",
"engines": {
"node": ">=6.0.0"
},

@@ -14,4 +14,5 @@ "publishConfig": {

"type": "git",
"url": "git://github.com/node-serialport/parsers.git"
}
"url": "git://github.com/node-serialport/node-serialport.git"
},
"gitHead": "40a06fb71d659940ed5058316b594b9da9957c2f"
}

@@ -1,1 +0,1 @@

See our api docs https://node-serialport.github.io/parsers/DelimiterParser.html
See our api docs https://node-serialport.github.io/node-serialport/DelimiterParser.html
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc