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

good-table

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

good-table - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

8

index.js

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

// taken from https://github.com/chalk/ansi-regex/blob/master/index.js because
// it's not very safe to import 2 modules to get 1 line of code
const ansi = new RegExp('[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))', 'g')
module.exports = function table (arr, padding = 2) {

@@ -5,3 +9,3 @@ const width = []

subArr.forEach((e, i) => {
width[i] = Math.max(width[i] || 0, e.length)
width[i] = Math.max(width[i] || 0, e.replace(ansi, '').length)
})

@@ -13,3 +17,3 @@ })

subArr.forEach((e, i) => {
ret += e + ' '.repeat(width[i] - e.length) +
ret += e + ' '.repeat(width[i] - e.replace(ansi, '').length) +
((i === subArr.length - 1) ? '\n' : ' '.repeat(padding))

@@ -16,0 +20,0 @@ })

{
"name": "good-table",
"version": "1.0.0",
"version": "1.0.1",
"description": "format array of arrays as a table with no config",

@@ -5,0 +5,0 @@ "main": "index.js",

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