New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chalk-animation

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chalk-animation - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

43

cli.js
#!/usr/bin/env node
const meow = require('meow');
const chalkAnim = require('.');
if (process.argv.length < 4) {
console.error('Usage\n $ chalk-animation <name> [text...]');
console.error('\nAvailable animations\n ' + Object.keys(chalkAnim).join('\n '));
console.error('\nExample\n $ chalk-animation rainbow Hello world!');
// eslint-disable-next-line no-process-exit
process.exit(2);
const names = Object.keys(chalkAnim);
const cli = meow(`
Usage
$ chalk-animation <name> [options] [text...]
Options
--duration Duration of the animation in ms, defaults to Infinity
--speed Animation speed as number > 0, defaults to 1
Available animations
${names.join('\n ')}
Example
$ chalk-animation rainbow Hello world!
`);
if (cli.input.length < 2) {
cli.showHelp(2);
}
if (!(process.argv[2] in chalkAnim)) {
console.error('error: unknown animation name:', process.argv[2]);
// eslint-disable-next-line no-process-exit
const name = cli.input[0];
const payload = cli.input.slice(1);
const effect = chalkAnim[name];
if (typeof effect === 'undefined') {
console.error(`error: unknown animation name: "${name}", must be one of: ${names.join(', ')}`);
process.exit(1);
}
const effect = chalkAnim[process.argv[2]];
const animation = effect(payload.join(' '), cli.flags.speed);
effect(process.argv.slice(3).join(' '));
if (typeof cli.flags.duration === 'number') {
setTimeout(() => {
animation.stop();
}, cli.flags.duration);
}
'use strict';
const chalk = require('chalk');

@@ -9,3 +10,3 @@ const gradient = require('gradient-string');

const consoleFunctions = {
log: console.log.bind(console),
log: log.bind(console),
info: console.info.bind(console),

@@ -72,2 +73,3 @@ warn: console.warn.bind(console),

const chunks = [];
for (let i = 0, length = str.length; i < length; i++) {

@@ -176,6 +178,8 @@ const skip = Math.round(Math.max(0, (Math.random() - 0.8) * chunkSize));

module.exports.rainbow = (str, speed) => animateString(str, effects.rainbow, 15, speed);
module.exports.pulse = (str, speed) => animateString(str, effects.pulse, 16, speed);
module.exports.glitch = (str, speed) => animateString(str, effects.glitch, 55, speed);
module.exports.radar = (str, speed) => animateString(str, effects.radar, 50, speed);
module.exports.neon = (str, speed) => animateString(str, effects.neon, 500, speed);
module.exports = {
rainbow: (str, speed) => animateString(str, effects.rainbow, 15, speed),
pulse: (str, speed) => animateString(str, effects.pulse, 16, speed),
glitch: (str, speed) => animateString(str, effects.glitch, 55, speed),
radar: (str, speed) => animateString(str, effects.radar, 50, speed),
neon: (str, speed) => animateString(str, effects.neon, 500, speed)
};
{
"name": "chalk-animation",
"description": "Colorful animations in terminal output",
"version": "1.3.0",
"version": "1.4.0",
"author": "Boris K",

@@ -10,3 +10,4 @@ "bugs": "https://github.com/bokub/chalk-animation/issues",

"chalk": "^2.1.0",
"gradient-string": "^0.1.2"
"gradient-string": "^0.1.2",
"meow": "^4.0.0"
},

@@ -13,0 +14,0 @@ "devDependencies": {

@@ -6,3 +6,4 @@ # chalk-animation

[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![Code Climate](https://img.shields.io/codeclimate/github/bokub/chalk-animation.svg)](https://codeclimate.com/github/bokub/chalk-animation)
[![Maintainability](https://api.codeclimate.com/v1/badges/0bd482faab1f6b4c94e8/maintainability)](https://codeclimate.com/github/bokub/chalk-animation/maintainability)
[![npm](https://img.shields.io/npm/dm/chalk-animation.svg)](https://www.npmjs.com/package/chalk-animation)

@@ -26,3 +27,3 @@ > Colorful animations in terminal output

```bash
$ npm install --save chalk-animation
$ npm i chalk-animation
```

@@ -116,14 +117,20 @@

Usage
$ chalk-animation <name> [text...]
Colorful animations in terminal output
Available animations
rainbow
pulse
glitch
radar
neon
Usage
$ chalk-animation <name> [options] [text...]
Example
$ chalk-animation rainbow Hello world!
Options
--duration Duration of the animation in ms, defaults to Infinity
--speed Animation speed as number > 0, defaults to 1
Available animations
rainbow
pulse
glitch
radar
neon
Example
$ chalk-animation rainbow Hello world!
```

@@ -130,0 +137,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc