58ca4e68db
- Go backend API with full CRUD for all modules (CRM, Sales, Finance, HR, Legal, Marketing, Support, Purchase, Inventory, Projects, Automation, Analytics) - Rust analytics service with parallel report generation - C runtime with POSIX shared memory IPC - PostgreSQL schema with 30+ tables, full migrations - Redis cache, sessions, pub/sub - Kafka event streaming with Zookeeper - WebSocket hub for real-time updates - Automation engine with cron jobs, workflows, event triggers - JWT authentication, multi-tenant from start - Docker Compose with all services - Nginx reverse proxy with rate limiting - Integration tests passing - Feature gap analysis against Fortnox/Odoo/Visma Refs: BOC-001
27 lines
690 B
JavaScript
27 lines
690 B
JavaScript
/**
|
|
* Encodes a string in a colour: red, yellow or green
|
|
* @param {String} c colour to highlight in
|
|
* @param {String} str the string to encode
|
|
* @return {String} coloured string for terminal printing
|
|
*/
|
|
function colour(c, str) {
|
|
return (colour[c] || colour.black) + str + colour.black;
|
|
}
|
|
|
|
function strip(str) {
|
|
re.lastIndex = 0; // reset position
|
|
return str.replace(re, '');
|
|
}
|
|
|
|
colour.red = '\x1B[31m';
|
|
colour.yellow = '\x1B[33m';
|
|
colour.green = '\x1B[32m';
|
|
colour.black = '\x1B[39m';
|
|
|
|
var reStr = Object.keys(colour).map(key => colour[key]).join('|');
|
|
var re = new RegExp(('(' + reStr + ')').replace(/\[/g, '\\['), 'g');
|
|
|
|
colour.strip = strip;
|
|
|
|
module.exports = colour;
|