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

cowsay-tag

v1.3.3

Published

es6 template-tag function for cowsay

Downloads

20

Readme

cowsay-tag Build Status npm version

es6 template-tag function for cowsay

Usage

cowsay`Just type cowsay before your
template string, and the
cow will say it!`;

outputs

 ______________________________
/ Just type cowsay before your \
| template string, and the     |
\ cow will say it!             /
 ------------------------------
    \   ^__^
     \  (oo)_______
        (__)       )/\
            ||----w |
            ||     ||

Custom cows

You can use a custom cow defined in the src/cows.js file:

cowsay('snake')`Just type cowsay before your
template string, and the
cow will ssssay it!`;

outputs

 ______________________________
/ Just type cowsay before your \
| template string, and the     |
\ cow will ssssay it!          /
 ------------------------------
   \       /^\/^\
    \    _|__|  O|
\/     /~     \_/ \
 \____|__________/  \
        \_______      \
                `\     \                 \
                  |     |                  \
                 /      /                    \
                /     /                       \\
              /      /                         \ \
             /     /                            \  \
           /     /             _----_            \   \
          /     /           _-~      ~-_         |   |
         (      (        _-~    _--_    ~-_     _/   |
          \      ~-____-~    _-~    ~-_    ~-_-~    /
            ~-_           _-~          ~-_       _-~
               ~--______-~                ~-___-~

You can also define a cow directly as the tag function's param:

cowsay(`   \\  I'm
    \\ a
      cow!`)`Just type cowsay before your
template string, and the
"cow" will say it!`;

outputs

 ______________________________
/ Just type cowsay before your \
| template string, and the     |
\ "cow" will say it!           /
 ------------------------------
   \  I'm
    \ a
      cow!

Including cowsay-tag in your app:

using the UMD module (cowsay-tag.js/npm install cowsay-tag):

const cowsay = require('cowsay-tag');
// or import cowsay from 'cowsay-tag';

cowsay`This works`;

using the script-friendly module (cowsay-tag.min.js):

see this jsbin!

Contributing

To contribute, you just need to fork the repo, clone your fork, and npm install to install all of the development dependencies (it's recommended to use node v6.x and npm v3.x).

There are three npm scripts that can be used to build cowsay-tag and run tests:

  • npm run build builds the release bundles (cowsay-tag.js and cowsay-tag.min.js) to the lib folder once
  • npm run dev watches for changes to the src directory and rebuilds the release bundles anytime the source changes
  • npm test watches for changes in the src and test directories, and rebuilds the release bundles, then runs unit tests

Please open a pr to the master branch, so that Travis can run both eslint and unit tests.

Contribution is open to all, and I'm happy to help guide beginner developers through the contribution process. If you're unsure how to do something but have a cool idea (or just a question about how something works), please open an issue and we can take the conversation from there.

Contribution to the custom cows file (src/cows.js) is greatly appreciated! Please include the source of where you got the ascii art, and please do not strip any identifying marks (such as initials) if they are there. Offensive cows will not be accepted for inclusion into this library, but you can include those types of things directly in the tag function's param (see above for an example).

Thanks

Thanks to Krasimir Tsonev (krasimir) for his project which bootstrapped the build process for the library, and thanks to Nicholas C. Zakas for his book Understanding ECMAScript 6 which provided the inspiration for the project.

Thanks to Dr. Axel Rauschmayer for his article on computing tag functions. His ideas were super helpful in figuring how to support both cowsay and cowsay("custom").