Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-output

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-output - npm Package Compare versions

Comparing version 2.2.1 to 3.0.0

61

index.js

@@ -1,5 +0,17 @@

const symbols = require('log-symbols');
const chalk = require('chalk');
/* istanbul ignore next */
const isWindows = () =>
(process.platform === 'win32' && process.env.TERM !== 'xterm-256color') ||
process.env.SIMPLE_OUTPUT_NO_ICONS;
/* istanbul ignore next */
const hasBasicColorSupport = () => (
/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(
process.env.TERM) || process.env.COLORTERM
);
const colors = () =>
process.env.FORCE_COLOR === 'true' ||
(hasBasicColorSupport() && !process.env.CI);
// --

@@ -9,35 +21,38 @@

function success(msg) {
module.exports.stdout.write(symbols.success + ' ' + msg + '\n');
const symbol = isWindows() ? '√' : '✔';
const prefix = colors() ? `${symbol}` : symbol;
module.exports.stdout.write(`${prefix} ${msg}\n`);
}
function error(msg) {
module.exports.stderr.write(symbols.error + ' ' + msg + '\n');
function info(msg) {
const symbol = isWindows() ? 'i' : 'ℹ';
const prefix = colors() ? `${symbol}` : symbol;
module.exports.stdout.write(`${prefix} ${msg}\n`);
}
function info(msg) {
module.exports.stdout.write(symbols.info + ' ' + msg + '\n');
function warn(msg) {
const symbol = isWindows() ? '‼' : '⚠';
const prefix = colors() ? `${symbol}` : symbol;
module.exports.stdout.write(`${prefix} ${msg}\n`);
}
function message(msg) {
module.exports.stdout.write(msg + '\n');
function error(msg) {
const symbol = isWindows() ? '×' : '✖';
const prefix = colors() ? `${symbol}` : symbol;
module.exports.stderr.write(`${prefix} ${msg}\n`);
}
function hint(msg) {
module.exports.stdout.write(chalk.dim(msg) + '\n');
function node(msg) {
const symbol = isWindows() ? '*' : '⬢';
const prefix = colors() ? `${symbol}` : symbol;
module.exports.stdout.write(`${prefix} ${msg}\n`);
}
function warn(msg) {
module.exports.stdout.write(symbols.warning + ' ' + msg + '\n');
function message(msg) {
module.exports.stdout.write(`${msg}\n`);
}
function node(msg) {
if (process.platform === 'win32') {
return success(msg);
}
const icon = '⬢';
const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
const node = chalk.green(
icon.replace(matchOperatorsRegex, '\\$&')
);
module.exports.stdout.write(node + ' ' + msg + '\n');
function hint(msg) {
const styledMsg = colors() ? `${msg}` : msg;
module.exports.stdout.write(`${styledMsg}\n`);
}

@@ -44,0 +59,0 @@

{
"name": "simple-output",
"version": "2.2.1",
"version": "3.0.0",
"main": "index.js",

@@ -11,3 +11,3 @@ "files": [

},
"description": "Output messages to stdout/stderr",
"description": "Output messages to stdout/stderr, zero deps.",
"homepage": "https://github.com/ruyadorno/simple-output",

@@ -17,3 +17,4 @@ "bugs": "https://github.com/ruyadorno/simple-output/issues",

"name": "Ruy Adorno",
"url": "http://ruyadorno.com"
"url": "http://ruyadorno.com",
"twitter": "ruyadorno"
},

@@ -35,12 +36,10 @@ "repository": {

"devDependencies": {
"jshint": "^2.12.0"
"jshint": "^2.13.3",
"tap": "^15.1.6"
},
"dependencies": {
"chalk": "^4.1.0",
"log-symbols": "^4.0.0"
},
"scripts": {
"pretest": "jshint index.js test.js",
"test": "node test.js"
"test": "tap test.js",
"snap": "tap -S test.js"
}
}

@@ -7,4 +7,12 @@ # simple-output

Pretty output messages to stdout/stderr
Pretty output messages to stdout/stderr with no extra dependencies.
<div align="center">
<br>
<br>
<img alt="render examples" width="350" src="https://user-images.githubusercontent.com/220900/150694210-7284e3fe-e713-42a4-98b9-f6d42dad9ac1.png">
<br>
<br>
</div>
## Getting Started

@@ -24,8 +32,8 @@ Install the module with: `npm install simple-output`

- success(msg)
- error(msg)
- info(msg)
- message(msg)
- hint(msg)
- node(msg)
- warn(msg)
- error(msg)
- node(msg) prints a green hexagon icon (on supported platforms) along with msg
- message(msg) prints msg, no icon associated with it
- hint(msg) useful if you want to dim some of the output

@@ -69,3 +77,3 @@ ## Testing

[MIT](LICENSE) © 2021 [Ruy Adorno](http://ruyadorno.com)
[MIT](LICENSE) © 2022 [Ruy Adorno](http://ruyadorno.com)
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