smartlog-destination-local/dist/beautylog.node.code.js

20 lines
2.2 KiB
JavaScript

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