concap
Tiny module for buffering and redirecting console methods.
Installation
$ npm install concap --save
Usage
Printing one-two-three with hijacking
var concap = ; console; concap;console; // `3` captured hereconcap; console;concap; // and flushed here
will output:
123
warn
call
Collect a var concap = ; concap;console;concap; var calls = concap;console;console;
will show:
method: 'warn' args: 'buffered' /output/ {} console;
Using local instance of console
It is also possible to make console instance to use it locally:
var concap = ; var local = ;var calls = ;local;local; console;
will generate:
thiscons;
Capturing logs using shortcut
var concap = ; var res = concap; console; { console; return `<html> <head></head> <body></body> </html>`;} { return html;}
This is just an example of parkur ninja style. Please don't repeat this by yourself: it's dangerous!
License
MIT