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

cli-banner

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-banner - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

1

lib/bin.js

@@ -29,2 +29,3 @@ #!/usr/bin/env node

describe: 'Content for banner',
coerce: str => str.replace(new RegExp('\\\\n', 'g'), '\n'),
});

@@ -31,0 +32,0 @@ })

18

lib/index.js

@@ -75,3 +75,4 @@ const chalk = require('chalk');

function printRow(str, width, paddingLength, color, border, borderColor) {
const extraSpace = width - 2 - 2 * paddingLength - str.length;
const borderLength = border.length;
const extraSpace = width - 2 * (paddingLength + borderLength) - str.length;

@@ -90,7 +91,14 @@ const leftSpacing = Math.floor(extraSpace / 2);

function printContent(str, width, paddingLength, color, border, borderColor) {
return wrap(str, { width: width - 2 * paddingLength })
function printContent(input, width, paddingLength, color, border, borderColor) {
const borderLength = border.length;
return input
.split('\n')
.map(s => s.trim())
.map(s => printRow(s, width, paddingLength, color, border, borderColor))
.map(str =>
wrap(str, {
width: width - 2 * (paddingLength + borderLength),
}).split('\n')
)
.reduce((output, strs) => output.concat(strs), [])
.map(str => str.trim())
.map(str => printRow(str, width, paddingLength, color, border, borderColor))
.join('\n');

@@ -97,0 +105,0 @@ }

@@ -14,2 +14,5 @@ const composeBanner = require('./index');

});
it('respects breaks', () => {
expect(composeBanner('hello\nworld')).toMatchSnapshot();
});
});
{
"name": "cli-banner",
"version": "1.0.2",
"version": "1.0.3",
"description": "Create boxes around content",
"license": "MIT",
"engines": {
"node": "^8.9.0",
"yarn": "^1.3.2"
"node": ">=6.0.0"
},

@@ -10,0 +9,0 @@ "files": [

@@ -1,2 +0,2 @@

## CLI Box
## CLI Banner

@@ -3,0 +3,0 @@ Create boxes around strings - great for console printing

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