New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

chog

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chog

Simplified Chalk and Console.log with Web Friendly util.inspect for Arrays and Objects

latest
Source
npmnpm
Version
0.0.20
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

chog

Simplified Chalk and Console.log with Web Friendly util.inspect for Arrays and Objects

  • This library modifies the String.prototype, Number.prototype, and Boolean.prototype for the current shell session.
  • Combines advanced color techniques to simplify console.log messages.
  • Add colors and styles to Strings, Numbers, and Booleans.
  • NPM chog
// download
npm i chog

// commonjs
const chog = require('chog');
// esm
import chog from 'chog';

// chog will console.log for you.                    any order 👇
chog.black.whiteBg('before red', " I'm italic red ".red.italic.underline.blackBg, 'after red.');

// Types
import { type Chog } from 'chog';

Colors

// Colors
const colors = [
  'black', 'red',
  'green', 'yellow',
  'blue', 'magenta',
  'cyan', 'white', '
  gray', 'grey'
];
const backgroundColors = [
  'blackBg', 'redBg',
  'greenBg', 'yellowBg',
  'blueBg', 'magentaBg',
  'cyanBg', 'whiteBg',
  'grayBg', 'greyBg',
];
const styles = ['bolder', 'dim', 'italic', 'underline', 'reset'];

Simple Example

Multiple items console.log with colors

// see image 👆
chog('Danger Will Robinson!'.red, 'The message awaits...');
chog.blue('Danger Will Robinson!'.red, 'The message awaits...');
// more!
chog.black.whiteBg('before red', " I'm italic red ".red.italic.underline.blackBg, 'after red.');
// same as                                           reset must come last 👇
chog.black.whiteBg('before red', " I'm italic red ".red.italic.underline.reset, 'after red.');

// Numbers
chog((123).red, (456).white.bolder.italic);

// Booleans
chog(true.green.underline.italic, false.blue.bolder);

Advanced Example

Automatic object destructure

// Automatic web friendly 'util.inspect' object destructuring 👆.
// Object and Array colors are fixed and cannot be altered.
const obj = {
  a: 'a',
  b: {
    c: false,
    d: {
      e: [1, 2, 3, 4, 5, { f: 'one', g: ['two', 3, true, { h: 'three' }] }],
      g: {
        p: (v: string) => {
          return '?';
        },
      },
    },
  },
};
const arr = [
  2,
  4,
  7,
  'the',
  {
    p: 'hi',
    q: 2,
    z: {
      super: 'nested',
      a: {
        b: 'great!',
      },
    },
  },
];

chog.blue.yellowBg(
  'multiple javascript types',
  (64).red.reset,
  obj,
  arr,
  false.greenBg,
  undefined,
  'the end.'
);

License

Published under the Apache-2.0 license. © Bryon Smith 2024.

Keywords

console.log

FAQs

Package last updated on 07 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts