Comparing version 0.0.7-1 to 0.0.7-2
@@ -9,4 +9,8 @@ import { ClassAnalyzer } from "./class-analyzer"; | ||
getName(): any; | ||
private isClass(); | ||
private isVariableDeclaration(); | ||
isCandidate(): boolean; | ||
private getBaseClassSimple(); | ||
private getBaseClassWithDeclaration(); | ||
getBaseClass(): any; | ||
} |
@@ -16,11 +16,25 @@ "use strict"; | ||
Es6ClassAnalyzer.prototype.getMember = function () { | ||
return this.node.body.body; | ||
if (this.isClass()) | ||
return this.node.body.body; | ||
else | ||
return this.node.declarations[0].init.body.body; | ||
}; | ||
Es6ClassAnalyzer.prototype.getName = function () { | ||
return this.node.id.name; | ||
if (this.isClass()) | ||
return this.node.id.name; | ||
else | ||
return this.node.declarations[0].init.id.name; | ||
}; | ||
Es6ClassAnalyzer.prototype.isCandidate = function () { | ||
Es6ClassAnalyzer.prototype.isClass = function () { | ||
return this.node.type == core_1.SyntaxKind.ClassDeclaration; | ||
}; | ||
Es6ClassAnalyzer.prototype.getBaseClass = function () { | ||
Es6ClassAnalyzer.prototype.isVariableDeclaration = function () { | ||
return this.node.type == core_1.SyntaxKind.VariableDeclaration && | ||
this.node.declarations[0].init && | ||
this.node.declarations[0].init.type == core_1.SyntaxKind.ClassExpression; | ||
}; | ||
Es6ClassAnalyzer.prototype.isCandidate = function () { | ||
return this.isClass() || this.isVariableDeclaration(); | ||
}; | ||
Es6ClassAnalyzer.prototype.getBaseClassSimple = function () { | ||
if (!this.node.superClass) | ||
@@ -33,4 +47,18 @@ return; | ||
}; | ||
Es6ClassAnalyzer.prototype.getBaseClassWithDeclaration = function () { | ||
if (!this.node.declarations[0].init.superClass) | ||
return; | ||
if (this.node.declarations[0].init.superClass.type == core_1.SyntaxKind.MemberExpression) | ||
return this.node.declarations[0].init.superClass.property.name; | ||
else | ||
return this.node.declarations[0].init.superClass.name; | ||
}; | ||
Es6ClassAnalyzer.prototype.getBaseClass = function () { | ||
if (this.isClass()) | ||
return this.getBaseClassSimple(); | ||
else | ||
return this.getBaseClassWithDeclaration(); | ||
}; | ||
return Es6ClassAnalyzer; | ||
}(class_analyzer_1.ClassAnalyzer)); | ||
exports.Es6ClassAnalyzer = Es6ClassAnalyzer; |
{ | ||
"name": "kecubung", | ||
"version": "0.0.7-1", | ||
"version": "0.0.7-2", | ||
"description": "Javascript transformer to Type Metadata", | ||
@@ -5,0 +5,0 @@ "main": "./lib/source/index.js", |
75227
1827