You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

binary-parser-encoder

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binary-parser-encoder - npm Package Compare versions

Comparing version

to
1.4.3

20

lib/binary_parser.js

@@ -768,3 +768,2 @@ //========================================================================================

var name = ctx.generateVariable(this.varName);
var maxLen = ctx.generateTmpVariable();

@@ -920,14 +919,10 @@ // Get the length of string to encode

ctx.pushCode("var {0} = 0;", maxItems);
// Get default array length (if defined)
ctx.pushCode("if({0}) {{1} = {0}.length;}", name, maxItems);
// Compute the desired count of array items to encode (min of array size and length option)
if (length !== undefined) {
var tmpLength = ctx.generateTmpVariable();
ctx.pushCode("var {0} = {1};", tmpLength, length);
ctx.pushCode(
"var {0} = {1}.length > {2} ? {2} : {1}.length;",
maxItems,
name,
tmpLength
);
} else {
ctx.pushCode("var {0} = {1}.length;", maxItems, name);
ctx.pushCode("{0} = {0} > {1} ? {1} : {0};", maxItems, length);
}

@@ -943,2 +938,4 @@

ctx.pushCode("if({0} > 0) { ", maxItems);
ctx.pushCode("var {0} = 0;", itemCounter);

@@ -996,2 +993,3 @@ if (

}
ctx.pushCode("}"); // End of 'if(...) {'

@@ -998,0 +996,0 @@ var tmpBuffer = ctx.generateTmpVariable();

{
"name": "binary-parser-encoder",
"version": "1.4.2",
"version": "1.4.3",
"description": "Blazing-fast binary parser builder",

@@ -5,0 +5,0 @@ "main": "lib/binary_parser.js",