serialijse
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -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(); | ||
}); | ||
}); | ||
}()); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
1
1
19691
9
376