Type definitions and tests for node luaparse module

This commit is contained in:
Sam Saint-Pettersen
2015-07-14 20:17:45 +01:00
parent 34b5eb499d
commit 5518db1fd9
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
/// <reference path="luaparse.d.ts" />
import luaparse = require('luaparse');
var luacode: string = '-- this is hello world in lua.\nprint(\'hello world\')';
var ast: Object = luaparse.parse(luacode);
console.log(JSON.stringify(ast));
ast = luaparse.parse(luacode, {comments: false});
console.log(JSON.stringify(ast));

8
luaparse/luaparse.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for luaparse
// Project: https://github.com/oxyc/luaparse
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "luaparse" {
export function parse(code: string, options?: Object): Object;
}