Comparing version 0.1.9 to 0.1.10
@@ -11,3 +11,3 @@ { | ||
"description": "Smith is an RPC agent system for Node.JS used in architect and vfs.", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"scripts": { | ||
@@ -14,0 +14,0 @@ "test": "./test-all.sh" |
14
smith.js
@@ -417,3 +417,3 @@ /* | ||
// pass primitives through as-is | ||
if (type !== "function" && type !== "object" && type !== "array") { | ||
if (type !== "function" && type !== "object" && type !== "array" && type !== "date") { | ||
return value; | ||
@@ -438,2 +438,6 @@ } | ||
if (type === "date") { | ||
o = {d:value.getTime()}; | ||
} | ||
if (o) return {$:o}; | ||
@@ -476,2 +480,6 @@ | ||
} | ||
if (typeof special === "object") { | ||
parent[key] = new Date(special.d); | ||
return parent[key]; | ||
} | ||
// Load functions | ||
@@ -508,2 +516,6 @@ parent[key] = getFunction(special); | ||
} | ||
// TODO: find a way to work with Date instances from other contexts. | ||
if (value instanceof Date) { | ||
return "date"; | ||
} | ||
return typeof value; | ||
@@ -510,0 +522,0 @@ } |
@@ -22,3 +22,4 @@ require('./helpers'); | ||
[{fn:foo}, {fn:{$:3}}], | ||
[cycle, {a:true,b:false,d:[1,2,3],e:{$:["d"]},cycle:{$:[]}}] | ||
[cycle, {a:true,b:false,d:[1,2,3],e:{$:["d"]},cycle:{$:[]}}], | ||
[new Date("Sun, 28 Mar 1982 11:46:00 MST"), {$:{d:0x59eaaaee40}}] | ||
]; | ||
@@ -61,3 +62,3 @@ | ||
if (getType(b) !== type) return false; | ||
if (type === "buffer") return a.toString() === b.toString(); | ||
if (type === "buffer" || type === "date") return a.toString() === b.toString(); | ||
if (type !== "object" && type !== "array") return a === b; | ||
@@ -64,0 +65,0 @@ |
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
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
84837
24
1330