smartlog-destination-local/ts/beautylog.node.code.ts
2016-02-23 14:34:40 +01:00

18 lines
557 B
TypeScript

/// <reference path="./typings/main.d.ts" />
var codeFunction = function(codeString,options?){
let hlight = require("hlight");
var codeSnippet = {
source:codeString,
highlighted:"default"
};
if (typeof codeString != "string"){
console.log("beautylog.code() expects a string as first argument!");
return;
};
if (typeof options != "undefined"){
codeSnippet.highlighted = hlight(codeSnippet.source,options.language);
//console.log(codeSnippet.highlighted)
}
};
export = codeFunction;