@colyseus/schema
Advanced tools
Comparing version 0.4.40 to 0.4.41
@@ -57,2 +57,5 @@ "use strict"; | ||
var isUpcaseFirst = prop.childType.match(/^[A-Z]/); | ||
if (prop.type !== "ref" && isUpcaseFirst) { | ||
ctorArgs = prop.childType + ".class"; | ||
} | ||
if (prop.type === "ref") { | ||
@@ -62,22 +65,21 @@ langType = (isUpcaseFirst) | ||
: typeMaps[prop.childType]; | ||
initializer = "new " + langType + ((prop.type !== "ref" && isUpcaseFirst) ? "<>" : "") + "(" + ctorArgs + ")"; | ||
} | ||
else if (prop.type === "array") { | ||
if (isUpcaseFirst) { | ||
ctorArgs = prop.childType + ".class"; | ||
typeArgs += "/ref"; | ||
} | ||
langType = (isUpcaseFirst) | ||
? "ArraySchema<>" | ||
: "ArraySchema<" + typeMaps[prop.childType] + ">"; | ||
? "ArraySchema<" + prop.childType + ">" | ||
: "ArraySchema"; | ||
initializer = "new ArraySchema" + ((isUpcaseFirst) ? "<>" : "") + "(" + ctorArgs + ")"; | ||
} | ||
else if (prop.type === "map") { | ||
if (isUpcaseFirst) { | ||
ctorArgs = prop.childType + ".class"; | ||
typeArgs += "/ref"; | ||
} | ||
langType = (isUpcaseFirst) | ||
? "MapSchema<>" | ||
: "MapSchema<" + typeMaps[prop.childType] + ">"; | ||
? "MapSchema<" + prop.childType + ">" | ||
: "MapSchema"; | ||
initializer = "new MapSchema" + ((isUpcaseFirst) ? "<>" : "") + "(" + ctorArgs + ")"; | ||
} | ||
initializer = "new " + langType + "(" + ctorArgs + ")"; | ||
if (prop.type !== "ref") { | ||
typeArgs += (isUpcaseFirst) | ||
? "/ref" | ||
: "/" + prop.childType; | ||
} | ||
} | ||
@@ -84,0 +86,0 @@ else { |
{ | ||
"name": "@colyseus/schema", | ||
"version": "0.4.40", | ||
"version": "0.4.41", | ||
"description": "Schema-based binary serializer / de-serializer.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
148332
3588