typescript-to-lua
Advanced tools
Comparing version 0.1.6 to 0.2.0
@@ -110,14 +110,13 @@ "use strict"; | ||
var optionNames_1 = []; | ||
for (var key in optionDeclarations) { | ||
if (optionDeclarations[key]) { | ||
optionNames_1.push(key); | ||
var alias = optionDeclarations[key].alias; | ||
if (alias) { | ||
if (typeof alias === "string") { | ||
optionNames_1.push(alias); | ||
} | ||
else { | ||
optionNames_1.push.apply(optionNames_1, alias); | ||
} | ||
for (var _i = 0, _a = Object.keys(optionDeclarations); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
optionNames_1.push(key); | ||
var alias = optionDeclarations[key].alias; | ||
if (alias) { | ||
if (typeof alias === "string") { | ||
optionNames_1.push(alias); | ||
} | ||
else { | ||
optionNames_1.push.apply(optionNames_1, alias); | ||
} | ||
} | ||
@@ -124,0 +123,0 @@ } |
@@ -7,14 +7,2 @@ "use strict"; | ||
} | ||
// Get all children of a node, required until microsoft fixes node.getChildren() | ||
TSHelper.getChildren = function (node) { | ||
var children = []; | ||
node.forEachChild(function (child) { | ||
children.push(child); | ||
}); | ||
return children; | ||
}; | ||
// Get children filtered by function and cast to predefined type | ||
TSHelper.getChildrenOfType = function (node, typeFilter) { | ||
return this.getChildren(node).filter(typeFilter); | ||
}; | ||
// Reverse lookup of enum key by value | ||
@@ -95,4 +83,6 @@ TSHelper.enumName = function (needle, haystack) { | ||
if (type.symbol) { | ||
var comment = type.symbol.getDocumentationComment(checker); | ||
var decorators = comment.filter(function (_) { return _.kind === "text"; }).map(function (_) { return _.text.trim(); }).filter(function (_) { return _[0] === "!"; }); | ||
var comments = type.symbol.getDocumentationComment(checker); | ||
var decorators = comments.filter(function (comment) { return comment.kind === "text"; }) | ||
.map(function (comment) { return comment.text.trim(); }) | ||
.filter(function (comment) { return comment[0] === "!"; }); | ||
return decorators.indexOf(decorator) > -1; | ||
@@ -115,2 +105,24 @@ } | ||
}; | ||
TSHelper.hasGetAccessor = function (node, checker) { | ||
if (ts.isPropertyAccessExpression(node)) { | ||
var name_3 = node.name.escapedText; | ||
var type = checker.getTypeAtLocation(node.expression); | ||
if (type && type.symbol && type.symbol.members) { | ||
var field = type.symbol.members.get(name_3); | ||
return field && (field.flags & ts.SymbolFlags.GetAccessor) !== 0; | ||
} | ||
} | ||
return false; | ||
}; | ||
TSHelper.hasSetAccessor = function (node, checker) { | ||
if (ts.isPropertyAccessExpression(node)) { | ||
var name_4 = node.name.escapedText; | ||
var type = checker.getTypeAtLocation(node.expression); | ||
if (type && type.symbol && type.symbol.members) { | ||
var field = type.symbol.members.get(name_4); | ||
return field && (field.flags & ts.SymbolFlags.SetAccessor) !== 0; | ||
} | ||
} | ||
return false; | ||
}; | ||
return TSHelper; | ||
@@ -117,0 +129,0 @@ }()); |
{ | ||
"name": "typescript-to-lua", | ||
"license": "MIT", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"repository": "https://github.com/Perryvw/TypescriptToLua", | ||
@@ -33,3 +33,3 @@ "scripts": { | ||
"deep-equal": "^1.0.1", | ||
"lua.vm.js": "0.0.1", | ||
"fengari": "^0.1.2", | ||
"nyc": "^11.7.1", | ||
@@ -36,0 +36,0 @@ "tslint": "^5.9.1" |
# TypescriptToLua | ||
A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua! | ||
Large projects written in lua can become hard to maintain and make it easy to make mistakes. Writing code in TypeScript instead improves maintainability, readability and robustness, with the added bonus of good IDE support. This project is useful in any environment where Lua code is accepted, with the powerful option of simply declaring any existing API using TypeScript declaration files. | ||
[![Build Status](https://travis-ci.org/Perryvw/TypescriptToLua.svg?branch=master)](https://travis-ci.org/Perryvw/TypescriptToLua) | ||
@@ -5,0 +7,0 @@ [![Build status](https://ci.appveyor.com/api/projects/status/github/perryvw/typescripttolua?branch=master&svg=true)](https://ci.appveyor.com/project/Perryvw/typescripttolua) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
91240
1760
60