Socket
Socket
Sign inDemoInstall

serialijse

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serialijse - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

19

lib/serialijse.js

@@ -21,2 +21,4 @@ /*global exports*/

assert(object !== undefined,"serialize: expect a valid object to serialize ");
var index = [];

@@ -44,2 +46,5 @@ var objects = [];

assert(object !== undefined);
var className = object.constructor.name, s, v, id;

@@ -96,3 +101,5 @@

assert(object != undefined);
if (object === undefined) {
return undefined;
}

@@ -130,8 +137,12 @@ var serializingObject = {};

var data = JSON.parse(serializationString),
index = data[0],
var data;
if (typeof serializationString === 'string') {
data = JSON.parse(serializationString);
} else if (typeof serializationString ==='object') {
data = serializationString;
}
var index = data[0],
obj = data[1],
cache = [];
function deserialize_node_or_value(node) {

@@ -138,0 +149,0 @@ if ("object" === typeof node) {

{
"name": "serialijse",
"version": "0.0.4",
"version": "0.0.5",
"description": "serialize and deserialize your javascript objects, preserve your object model ",

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

@@ -228,4 +228,39 @@ /*global describe, it*/

});
it("should persist an object with a undefined property",function(done){
var vehicule = new Vehicule();
vehicule.serviceDate = [ undefined, new Date("2013/01/02")];
// try to mess with the serialisation algo by adding a fake null property
vehicule.toto = null;
var serializationString = serialize(vehicule);
// delete it as it should not interfer
delete vehicule.toto;
//xx console.log(serializationString);
var reconstructedObject = deserialize(serializationString);
reconstructedObject.should.eql(vehicule);
done();
});
it("should deserialize from an already parsed JSON string",function(done) {
var vehicule = new Vehicule();
var serializationString = serialize(vehicule);
var json_obj = JSON.parse(serializationString);
var reconstructedObject = deserialize(json_obj);
reconstructedObject.should.eql(vehicule);
done();
});
});
}());
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