node-smart-buffer
Advanced tools
+16
-2
@@ -320,3 +320,9 @@ const maximum = Math.pow( 2, 17 ) - 1; | ||
| } else { | ||
| encode.push( `buffer.${corner}( data.${attr}.length );` ); | ||
| if ( parseInt( corner ) == corner.trim() ) { | ||
| encode.push( `data.${attr}.length = ${parseInt(corner)};` ); | ||
| } else if ( corner.startsWith( '.' ) ) { | ||
| encode.push( `data.${attr}.length = data${corner};` ); | ||
| } else { | ||
| encode.push( `buffer.${corner}( data.${attr}.length );` ); | ||
| } | ||
| } | ||
@@ -334,3 +340,9 @@ encode.push( `for( var index = 0; index < data.${attr}.length; index++ )` ); | ||
| } else { | ||
| decode.push( `for ( var index = 0, length = buffer.${corner}(); index < length; index++ )` ); | ||
| if ( parseInt( corner ) == corner.trim() ) { | ||
| decode.push( `for ( var index = 0, length = ${parseInt(corner)}; index < length; index++ )` ); | ||
| } else if ( corner.startsWith( '.' ) ) { | ||
| decode.push( `for ( var index = 0, length = data${corner}; index < length; index++ )` ); | ||
| } else { | ||
| decode.push( `for ( var index = 0, length = buffer.${corner}(); index < length; index++ )` ); | ||
| } | ||
| } | ||
@@ -385,2 +397,4 @@ if ( source[ format ] ) { | ||
| decode.push( `} )` ); | ||
| console.log( encode.join( '\n' ) ); | ||
| console.log( decode.join( '\n' ) ); | ||
| encode = eval( encode.join( '\n' ) ); | ||
@@ -387,0 +401,0 @@ decode = eval( decode.join( '\n' ) ); |
+1
-1
| { | ||
| "name": "node-smart-buffer", | ||
| "version": "2.0.3", | ||
| "version": "2.1.0", | ||
| "description": "ring buffer & packet compile", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+2
-0
@@ -88,2 +88,4 @@ | ||
| `}`, | ||
| 'b:uint8[5]', | ||
| 'c:uint8[.a]', | ||
| ], | ||
@@ -90,0 +92,0 @@ DEMO2: [ |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
15843
4.64%398
3.65%134
1.52%