Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/tfunk/ |
Upload File : |
##tfunk [](https://travis-ci.org/shakyShane/tfunk) Multi-colour console output from [Chalk](https://github.com/sindresorhus/chalk#styles) with added awesome. by [@shakyshane](https://github.com/shakyShane) & [@AydinHassan](https://github.com/AydinHassan)  ##Install ```bash npm install tfunk ``` ##Usage **Syntax rules:** `{` `<color>` `:` `YOUR STRING` `}` **Example** `{blue:This is a blue line}` **`}` is optional** `{blue:This is a blue line` <- Perfectly valid ##Usage ```js var tFunk = require("tfunk"); console.log( tfunk("{cyan:tFunk terminal colours") ) // => tFunk terminal colours ``` Or get a custom compiler with a set prefix: ```js var compiler = require("tfunk").Compiler({ prefix: "[{magenta:tFunk}]" }); console.log( compiler.compile("tFunk is awesome") ); console.log( compiler.compile("don't you think?") ); // => [tFunk] tFunk is awesome // => [tFunk] don't you think? ``` **Define your own syntax** You can define your own methods, they receive the string section as the first parameter & have access to the compiler through `this.compile()` keyword. ```js var compiler = require("tfunk").Compiler({ "warn": function(string) { return this.compile("{red:WARNING:" + string); } }); ``` Now you can use `warn` anywhere you like. ```js console.log( compiler.compile("{warn: Could not file your config file...") ); // => WARNING: Could not file your config file... ``` ##Examples Here are some comparisons to chalk, to help you understand how to use tFunk. ###Single Colours ```js // chalk console.log( chalk.red("This has a single colour") ); // tFunk console.log( tFunk("{red:This has a single colour") ); ``` ###Single Colour mid string ```js // chalk console.log( "This has a single colour " + chalk.cyan("that begins mid-string") ); // tFunck console.log( tFunk("This has a single colour {cyan:that begins mid-string") ); ``` ###Single Colour with end point ```js // chalk console.log( chalk.red("This has a single colour with ") + "an endpoint"); // tFunk console.log( tFunk("{red:This has a single colour with }an endpoint") ); ``` ###Two Colours ```js // chalk console.log( chalk.green("This has ") + chalk.cyan("two colours") ); // tFunk console.log( tFunk("{green:This has {cyan:two colours") ); ``` ###Nested Colours ```js // chalk console.log( chalk.green("This has a colour " + chalk.cyan("nested inside") + " another colour") ); //tFunk console.log( tFunk("{green:This has a colour {cyan:nested inside} another colour") ); ``` ###Multiple Nested ```js // chalk console.log( chalk.blue("Multiple " + chalk.cyan("NESTED") + " styles in " + chalk.red("the same string") + " with an ending") ); // tFunk console.log( tFunk("{blue:Multiple {cyan:NESTED} styles in {red:the same string} with an ending") ); ``` ###Multi line ```js var multiline = require("multiline"); var string = multiline(function () {/* {cyan:This is a multi-line coloured string With a single {yellow:yellow} word in the center of a line Pretty cool huh? */}); console.log( tFunk(string) ); ``` ###Escaping when you need curly braces ```js console.log( tFunk("This has a \\{\\{mustache\\}\\}") ); ``` ##TODO - [x] Colours - [x] Nested Colours - [x] Custom syntax - [x] Prefixed compiler - [x] Make the chain-able API work like this `"{white.bgRed: White text, red BG"` - [x] Offer a way of escaping. Right now, ALL instances of `}` will be lost