23 lines
529 B
JavaScript
23 lines
529 B
JavaScript
import * as std from "std"
|
|
|
|
// helper stuff
|
|
var url = (text, link) => `\x1b]8;;${link}\x1b\\${text}\x1b]8;;\x1b\\`
|
|
var colors = {
|
|
reset: `\x1b[0m`,
|
|
black: `\x1b[30m`,
|
|
red: `\x1b[31m`,
|
|
green: `\x1b[32m`,
|
|
yellow: `\x1b[33m`,
|
|
blue: `\x1b[34m`,
|
|
magenta: `\x1b[35m`,
|
|
cyan: `\x1b[36m`,
|
|
white: `\x1b[37m`,
|
|
}
|
|
|
|
var input = JSON.parse(std.in.readAsString())
|
|
var output = eval('input' + scriptArgs.slice(1).join(' '));
|
|
if (typeof output === "object") {
|
|
console.log(JSON.stringify(output, null, 2))
|
|
} else {
|
|
console.log(output)
|
|
}
|