UNPKG

transit-im

Version:

express-like framework for AIM bots creation (ICQ as well)

43 lines (29 loc) 969 B
// Generated by CoffeeScript 1.6.3 (function() { var app, split, substituteName, transit, uppercase; transit = require('../../transit'); app = transit(); app.use(transit.commandLine()); app.use(transit.echo()); substituteName = function(data, options, next) { var _ref; return next(data.replace(/{name}/gi, (_ref = options != null ? options.name : void 0) != null ? _ref : "Unknown")); }; split = function(data, next) { return data.split(" ").forEach(next); }; uppercase = function(data) { return data.toUpperCase(); }; app.formatOutput(transit.chain(uppercase, split, substituteName)); app.start(); app.sendBack(1, "hello, {name}!", { name: "Alex" }); app.formatOutput("myFormat", transit.chain(transit.chain.json(), transit.chain.splitByPortions(50), transit.chain.wrapHtml())); app.sendBack.myFormat(1, { message: "Hello", type: "greeting", mime: "application/json" }); }).call(this);