npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cout

v0.0.6

Published

A basic JavaScript console utility with sprintf and colors support.

Downloads

8,832

Readme

cout

License Dependencies Downloads Version

NPM

A basic JavaScript console utility with sprintf and colors support.

##Install

sudo npm install --save cout

##Usage

var cout = require('cout'),
//sprintf(..., ...) or use cout.kawari(..., ...)
sprintf = cout.kawari;

//configure (optional)
cout.config({
	cout: ['warn', 'error']
});

//will print on a single line (no color)
cout("Hello", "World", {hello: "world"}, ['hello', 'world'], 1,2,3).end();
//will print on newlines (can be changed through cout.config()) (no color)
cout("Hello", "World", {hello: "world"}, ['hello', 'world'], 1,2,3).endl();

//will print with new line color (see themes for color/level)
cout("Hello", "World", {hello: "world"}, ['hello', 'world'], 1,2,3).warn();

//you can customize the background and styles (see styles)
cout("Hello", "World", {hello: "world"}, ['hello', 'world'], 1,2,3).warn({bg: 'green', style: 'bold'});

//sprintf from the top level (to keep things simple internally)
cout(sprintf('...', '...')).warn();

##Methods

  • end()
  • endl()
  • warn()
  • data()
  • debug()
  • error()
  • help()
  • info()
  • input()
  • prompt()
  • silly()
  • verbose()

##Config The following are the default values but can be changed

//configure
cout.config({
	....options....
});

{
	//specify which level (Array or String) to display
	//by default '*' means display all levels
	//if you pass a level array and want to display end() and endl()
	//just add 'normal' to the array.
	cout: ['*'],
	//default theme/colors/levels
	theme: {
	  data: 'grey',
	  debug: 'blue',
	  error: 'red',
	  help: 'cyan',
	  info: 'green',
	  input: 'grey',
	  prompt: 'grey',
	  silly: 'rainbow',
	  verbose: 'cyan',
	  warn: 'yellow',
	},
	//used for pretty printing json/plain objects
	json:{
	    space: 2
	},
	//specify the number of new lines.
	newline: '\n'
}

##Styles

####Usage

//use style key
{style: ...}
  • reset
  • bold
  • dim
  • italic
  • underline
  • inverse
  • hidden
  • strikethrough

##Background color

####Usage

//use bg key
{bg: ...}
  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white

##Time stamp

cout uses Moment.js for time stamps. See Moment.js' docs for formatting and locales.

###Usage

Default: false

Acceptable types: Boolean, Plain Object

//boolean
true or false

timestamp:{
	//format the time
	format:'dddd',
	//change the locale
	locale: 'ja',
	//spacing: can be tabs or spaces
	space: '\n'
}

##Changlog

0.0.1

  • Initial commit

0.0.2

  • Cleaned code and removed confusing debug statement.
  • Updated readme

0.0.3

  • Updated readme
  • Removed unnecessary comments.

0.0.4

  • Added node_modules to .gitignore

0.0.5

  • Added boolean support. You can now set {cout:...} to true or false.

0.0.6

  • Added time stamp support. You can pass a Boolean or configure the time stamp's locale and format by passing a plain Object.
  • Added 'normal' level for end() and endl() when using an array with levels.