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

zouti

v0.5.0

Published

Useful tools & functions (loggin' & hashin').

Downloads

25

Readme

zouti

NPM version Dependency Status Downloads counter

Useful tools & functions we use on every krkn projects.

Getting Started

Install the module with: npm install zouti

var zouti = require( "zouti" );

Documentation

zouti.log( message, context, type )

Print a formated console log like below, with date, context between brackets, then message.

5 Mar 22:58:06 - [node] foo

The type parameter is a String which can be :

  • "ERROR", "ERR", "RED" : print the message in red
  • "WARNING", "WARN", "YELLOW" : print the message in yellow
  • "SUCCESS", "GREEN" : print the message in green
  • "MAGENTA" : print the message in magenta
  • every other values prints the message in cyan

zouti.warning( message, context ), zouti.warn( message, context )

Alias for zouti.log( message, context, "WARNING" )

zouti.error( message, context ), zouti.notOk( message, context )

Alias for zouti.log( message, context, "ERROR" )

zouti.success( message, context ), zouti.ok( message, context )

Alias for zouti.log( message, context, "SUCCESS" )

zouti.spacer( amount )

Print amount (defaults to 1) empty console lines, as visual spacer.

zouti.mute()

Muting zouti by disable all the console.log calls until zouti.unmute() is called.

Note: if zouti is already muted, does nothing.

zouti.unmute()

Unmute zouti.

Note: if zouti is already unmuted, does nothing.

zouti.muted

Property returning a boolean, indicating the mute status of zouti.

zouti.clearConsole()

Clear the console by sending the string \u001B[2J\u001B[0;0f to it.

zouti.bench( name, log )

Called the first time, start a benchmark.
When it's called the second time with the same name, stop the benchmark and print elapsed time (if the log argument is set to true - which is by default), in milliseconds.
The second call returns an object with literal and numerical values (in milliseconds).

zouti.uuid()

Generate an UUID compliant to RFC 4122.

zouti.sleep( duration )

Make the program sleep for duration seconds. Note: this function must be used with care, eats a lot of CPU's power.

zouti.md5( string ), zouti.sha1( string ), zouti.sha256( string ), zouti.sha512( string ), zouti.whirlpool( string )

Returns the hashed version of the given string, using the specified algorythm.
These functions use the native crypto module of node.js.

zouti.kindOf( value )

Returns the type of the given value, returning number, string, boolean, function, regexp, array, date, error, null, undefined or object.
Based on grunt.util.kindOf.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Lint your code using Grunt.

Release History

  • 0.0.1: initial release (05/03/2014)
  • 0.1.0: refactor bench method (08/06/2014)
  • 0.2.0: add clearConsole method (03/10/2014)
  • 0.3.0: add aliases for log method (11/02/2015)
  • 0.4.0: add mute and unmute methods (12/01/2016)
  • 0.5.0: add spacer method (24/05/2016)

License

Copyright (c) 2014 leny & krkn
Licensed under the WTFPL license.