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

20 lines
2.2 KiB
JavaScript

/// <reference path="./typings/main.d.ts" />
var codeFunction = function (codeString, options) {
var 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);
}
};
module.exports = codeFunction;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5ub2RlLmNvZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBRTVDLElBQUksWUFBWSxHQUFHLFVBQVMsVUFBVSxFQUFDLE9BQVE7SUFDM0MsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQy9CLElBQUksV0FBVyxHQUFHO1FBQ2QsTUFBTSxFQUFDLFVBQVU7UUFDakIsV0FBVyxFQUFDLFNBQVM7S0FDeEIsQ0FBQztJQUNGLEVBQUUsQ0FBQyxDQUFDLE9BQU8sVUFBVSxJQUFJLFFBQVEsQ0FBQyxDQUFBLENBQUM7UUFDL0IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxzREFBc0QsQ0FBQyxDQUFDO1FBQ3BFLE1BQU0sQ0FBQztJQUNYLENBQUM7SUFBQSxDQUFDO0lBQ0YsRUFBRSxDQUFDLENBQUMsT0FBTyxPQUFPLElBQUksV0FBVyxDQUFDLENBQUEsQ0FBQztRQUMvQixXQUFXLENBQUMsV0FBVyxHQUFHLE1BQU0sQ0FBQyxXQUFXLENBQUMsTUFBTSxFQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUUxRSxDQUFDO0FBQ0wsQ0FBQyxDQUFDO0FBQ0YsaUJBQVMsWUFBWSxDQUFDIiwiZmlsZSI6ImJlYXV0eW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