Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 7x 7x 7x | "use strict"; let Caf = require("caffeine-script-runtime"); Caf.defMod(module, () => { return { highlight: function (js) { let chalk, cardinal, normalizeChalkColor, keywordColor, operatorColor, functionDeclarationColor, itentifierColor, options; chalk = require("chalk"); cardinal = require("cardinal"); normalizeChalkColor = (clk) => (str) => clk(str); keywordColor = normalizeChalkColor(chalk.yellow); operatorColor = normalizeChalkColor(chalk.magenta); functionDeclarationColor = normalizeChalkColor(chalk.blue); itentifierColor = (str) => str; options = { linenos: true, theme: { Identifier: { undefined: keywordColor, null: keywordColor, _default: (s, info) => { let prevToken, nextToken; prevToken = info.tokens[info.tokenIndex - 1]; nextToken = info.tokens[info.tokenIndex + 1]; return (Caf.exists(nextToken) && nextToken.type) === "Punctuator" && (Caf.exists(nextToken) && nextToken.value) === "(" && (Caf.exists(prevToken) && prevToken.type) === "Keyword" && (Caf.exists(prevToken) && prevToken.value) === "function" ? functionDeclarationColor(s) : (Caf.exists(nextToken) && nextToken.value) === ":" ? functionDeclarationColor(s) : itentifierColor(s); }, }, Line: { _default: normalizeChalkColor(chalk.grey) }, Block: { _default: normalizeChalkColor(chalk.grey) }, Boolean: { _default: keywordColor }, Null: { _default: keywordColor }, Numeric: { _default: normalizeChalkColor(chalk.red) }, String: { _default: normalizeChalkColor(chalk.green) }, Keyword: { _default: keywordColor }, Punctuator: { _default: operatorColor }, }, }; return cardinal.highlight(js, options); }, }; }); |