Socket
Socket
Sign inDemoInstall

bcode

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcode - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

package.json
{
"name": "bcode",
"version": "0.0.4",
"version": "0.0.5",
"description": "encoding handler for bitdb",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -281,2 +281,24 @@ const assert = require('assert');

})
it('should not delete if the top level attribute is being mutated', function() {
let src = {
b0: {
op: 106
},
b1: "bQI=",
b2: "aGVsbG8gd29ybGQ=",
s2: "hello world"
};
let expected = {
b0: {
op: 106
},
b1: "bQI=",
h1: "6d02",
b2: "aGVsbG8gd29ybGQ=",
s2: "hello world",
h2: "68656c6c6f20776f726c64"
};
let actual = bcode.decode(src)
comp(actual, expected)
})
})

@@ -402,2 +424,16 @@ describe('encode', function() {

})
it('should not delete if the top level attribute is being mutated', function() {
let actual = bcode.encode({
"out.b0": { "op": 106 },
"out.h1": "6d02",
"out.s2": "Hello World"
})
let expected = {
"out.b0": { "op": 106 },
"out.b1": "bQI=",
"out.s2": "Hello World"
}
comp(actual, expected)
})
});

@@ -404,0 +440,0 @@

@@ -48,4 +48,4 @@ /*

var encode = function(req) {
let copy = req
traverse(copy.q).forEach(function(token) {
let copy = { "$root": req }
traverse(copy).forEach(function(token) {
if (this.isLeaf) {

@@ -116,3 +116,3 @@ let encoding = "utf8"

node.parent.node[key] = node.node;
// 3. delete the old b-prefixed tree (need to delete because we'll use this for queries. If not deleted, it will become an AND operation)
// 3. delete the old h-prefixed tree (need to delete because we'll use this for queries. If not deleted, it will become an AND operation with the newly generated b-prefixed tree)
node.delete();

@@ -122,3 +122,3 @@ }

})
return copy
return copy["$root"]
}

@@ -125,0 +125,0 @@

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