@colyseus/schema
Advanced tools
Comparing version 0.4.8 to 0.4.9
@@ -46,3 +46,3 @@ "use strict"; | ||
var indent = (namespace) ? "\t" : ""; | ||
return types_1.getCommentHeader() + "\n\nusing Colyseus.Schema;\n" + (namespace ? "\nnamespace " + namespace + " {" : "") + "\n" + indent + "public class " + klass.name + " : Schema {\n" + klass.properties.map(function (prop) { return generateProperty(prop, indent); }).join("\n\n") + "\n" + indent + "}\n" + (namespace ? "}" : "") + "\n"; | ||
return types_1.getCommentHeader() + "\n\nusing Colyseus.Schema;\n" + (namespace ? "\nnamespace " + namespace + " {" : "") + "\n" + indent + "public class " + klass.name + " : " + klass.extends + " {\n" + klass.properties.map(function (prop) { return generateProperty(prop, indent); }).join("\n\n") + "\n" + indent + "}\n" + (namespace ? "}" : "") + "\n"; | ||
} | ||
@@ -49,0 +49,0 @@ function generateProperty(prop, indent) { |
@@ -12,5 +12,12 @@ "use strict"; | ||
currentClass = new types_1.Class(); | ||
var heritageClauses = node.heritageClauses; | ||
if (heritageClauses && heritageClauses.length > 0) { | ||
currentClass.extends = heritageClauses[0].types[0].getText(); | ||
} | ||
classes.push(currentClass); | ||
break; | ||
case ts.SyntaxKind.PropertyDeclaration: | ||
// case ts.SyntaxKind.PropertyDeclaration: | ||
// break; | ||
case ts.SyntaxKind.ExtendsKeyword: | ||
console.log(node.getText()); | ||
break; | ||
@@ -20,3 +27,8 @@ case ts.SyntaxKind.Identifier: | ||
var prop = node.parent.parent.parent; | ||
var typeDecorator = node.parent.parent.parent.decorators.find((function (decorator) { | ||
var propDecorator = node.parent.parent.parent.decorators; | ||
// ignore if "type" identifier doesn't have a decorator. | ||
if (!propDecorator) { | ||
break; | ||
} | ||
var typeDecorator = propDecorator.find((function (decorator) { | ||
return decorator.expression.expression.escapedText === "type"; | ||
@@ -23,0 +35,0 @@ })).expression; |
@@ -10,2 +10,3 @@ export declare function getCommentHeader(singleLineComment?: string): string; | ||
properties: Property[]; | ||
extends: string; | ||
} | ||
@@ -12,0 +13,0 @@ export interface File { |
{ | ||
"name": "@colyseus/schema", | ||
"version": "0.4.8", | ||
"version": "0.4.9", | ||
"description": "Schema-based binary serializer / de-serializer.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -183,4 +183,8 @@ <div align="center"> | ||
- `NaN` numbers are encoded as `0` | ||
- `null` strings are encoded as `""` | ||
- `null` numbers are encoded as `0` | ||
- `Infinity` numbers are encoded as `Number.MAX_SAFE_INTEGER` | ||
- Multi-dimensional arrays are not supported. | ||
- Array items must all have the same type as defined in the schema. | ||
- Items inside Arrays and Maps must be all of the same type. | ||
- `@colyseus/schema` encodes only field values in the specified order. | ||
@@ -187,0 +191,0 @@ - Both encoder (server) and decoder (client) must have same schema definition. |
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
88600
2121
268