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

rejoinder

v0.3.20

Published

A generator of smart, pretty, and organized output for Node/JS scripts in the terminal

Downloads

9

Readme

npm
version

REJOINDER

rejoinder
/rɪˈdʒɔɪndə/
noun
a reply or response to a question or remark, esp a quick witty one; retort

Rejoinder is that generator of smart, pretty, highly organized output your parents warned you about.

TODO: SPIN OFF EXECUTABLE POWERS INTO A SLASH-FILE VERSION i.e. rejoinder/execute

Super awesome when paired with inquirer and/or commander!

Installation

npm install rejoinder

If you want support from shelljs (required to use Execute), install that too:

npm install shelljs

Usage and Examples

const rejoinder = require('rejoinder');
let echo = rejoinder.echo;
let execute = rejoinder.execute;

echo.now('output this very important warning to the console with pretty colors'); // immediate output
echo.withPostfix.warn('output this very important warning to the console with pretty colors'); // colorful output prefixed with the string "WARN "

echo.beVerbose = true; // beVerbose fka "debugMode"
echo.ifVerbose('Some message will appear if beVerbose is true');
echo.ifDebug('Some debug message will appear if beVerbose is true prefixed with the string "DEBUG "');
echo.beVerbose = false; // it is false by default
echo.ifVerbose('Some message will NOT appear if beVerbose is false!');
echo.ifDebug('Some debug message will NOT appear if beVerbose is false!');

echo.if(somethingistrue, 'I spit only the truth!'); // also returns false if somethingistrue is false

echo.now('all', 'my', 'methods', 'are', 'also', 'variadic!'); // prints "all my methods are also variadic!"
echo.if(true, 'even', 'this', 'one :)'); // prints "even this one :)"

echo.prefix = '>>'; // this will be printed directly before the message every time
echo.now('changed', 'the', 'game!'); // prints ">> changed the game!"

echo.prefix = 'Big:Boy:Time:';
echo.messageSeparator = '||'; // this is the thing between the prefix and the message
echo.usingPredicate((str) => `"${str}"`, 'the', 'time', 'for', 'fun and games is', 'over!');
// the above prints `Big:Boy:Time:||"the" "time" "for" "fun and games is" "over!"`

echo.withPostfix('postfix', 'this is', 'pretty cool'); // prints "Big:Boy:Time::postfix||this is pretty cool"
echo.postfixSeparator = '<>'; // this is the thing between the prefix and the postfix. It goes `prefix + postfixsep + postfix + msgsep + message`
echo.withPostfix('postfix', 'this too'); // prints "Big:Boy:Time:<>postfix||this too"
echo.withPostfix.ok('GOT IT!'); // prints colorful output that says "Big:Boy:Time:<>OK||GOT IT!"

// ONLY the echo statements that appear inside of this function will have the aforesaid prefix
echo.withPrefix('~>', () =>
{
    echo.now('or'); // prints "~>||or"
    echo.now('is', 'it? I wonder.'); // prints "~>||is it? I wonder."
    echo.withPostfix('NO', 'Wait!'); // prints "~><>NO||Wait!"
    echo.withPostfix.action("Don't make me bring Execute into this..."); // prints colorful output "~><>ACTION||Don't make me bring Execute into this..."
});

echo.beVerbose = true;

// prints the command and the result of executing it thanks to echo.beVerbose! See API.md for more information on how this works
execute.now('return 0');

Documentation

See API.md

Tests

npm install
npm test

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style.

Add unit tests for any new or changed functionality. Lint and test your code.

Release History

  • 0.3.x Several bugfixes
  • 0.2.0 Initial working release; unit tested; semver versioning semantics are obeyed from this point forward
  • 0.1.x Rapid iteration