Socket
Socket
Sign inDemoInstall

table

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

README/demo.png

4

package.json
{
"name": "table",
"version": "2.0.0",
"version": "2.0.1",
"description": "Formats data into a string table.",

@@ -43,3 +43,3 @@ "main": "./dist/index.js",

"dependencies": {
"ansi-slice": "^1.0.3",
"ansi-slice": "^1.2.0",
"bluebird": "^2.10.0",

@@ -46,0 +46,0 @@ "lodash": "^3.10.1",

@@ -16,2 +16,4 @@ # Table

[!Demo of Table displaying a list of missions to Moon](./README/demo.png)
## Features

@@ -18,0 +20,0 @@

@@ -91,7 +91,5 @@ {

"border": {
"type": "string",
"minLength": 1,
"maxLength": 1
"type": "string"
}
}
}

@@ -11,3 +11,6 @@ import {

describe(`chunk`, () => {
// The reason these tests are being skipped is because `ansi-slice`
// pacakge suffixes string with all possible escape codes.
// Need to find a better way to test it.
xdescribe(`chunk`, () => {
context(`subject is a plain text string`, () => {

@@ -14,0 +17,0 @@ describe(`subject is lesser than the chunk size`, () => {

@@ -7,4 +7,10 @@ import {

import table from './../src/table';
import {
border
} from './../src/';
import table from './../src/';
import chalk from 'chalk';
describe(`readme`, () => {

@@ -19,2 +25,87 @@ let expectTable;

it(`draws expected table`, () => {
let data,
output,
tableBorder;
data = [
[
chalk.bold(`Spacecraft`),
chalk.bold(`Launch Date`),
chalk.bold(`Operator`),
chalk.bold(`Outcome`),
chalk.bold(`Remarks`)
],
[
`Able I`,
`17 August 1958`,
`USAF`,
chalk.white.bold.bgRed(` Launch failure `),
`First attempted launch beyond Earth orbit; failed to orbit due to turbopump gearbox malfunction resulting in first stage explosion.[3] Reached apogee of 16 kilometres (9.9 mi)`
],
[
`Luna 2`,
`12 September 1959`,
`OKB-1`,
chalk.black.bgGreen(` Successful `),
`Successful impact at 21:02 on 14 September 1959. First spacecraft to reach lunar surface`
],
[
`Lunar Orbiter 1`,
`10 August 1966`,
`NASA`,
chalk.black.bgYellow(` Partial failure `),
`Orbital insertion at around 15:36 UTC on 14 August. Deorbited early due to lack of fuel and to avoid communications interference with the next mission, impacted the Moon at 13:30 UTC on 29 October 1966.`
],
[
`Apollo 8`,
`21 December 1968`,
`NASA`,
chalk.black.bgGreen(` Successful `),
`First manned mission to the Moon; entered orbit around the Moon with four-minute burn beginning at 09:59:52 UTC on 24 December. Completed ten orbits of the Moon before returning to Earth with an engine burn at 06:10:16 UTC on 25 December. Landed in the Pacific Ocean at 15:51 UTC on 27 December.`
],
[
`Apollo 11`,
`16 July 1969`,
`NASA`,
chalk.black.bgGreen(` Successful `),
`First manned landing on the Moon. LM landed at 20:17 UTC on 20 July 1969`
]
];
tableBorder = _.mapValues(border(`honeywell`), (char) => {
return chalk.gray(char);
})
output = table(data, {
border: tableBorder,
column: {
0: {
paddingLeft: 1,
paddingRight: 1
},
1: {
paddingLeft: 1,
paddingRight: 1
},
2: {
paddingLeft: 1,
paddingRight: 1
},
3: {
paddingLeft: 1,
paddingRight: 1
},
4: {
paddingLeft: 1,
paddingRight: 1,
maxWidth: 50
}
}
});
console.log(output);
});
it(`draws expected table (basic)`, () => {

@@ -21,0 +112,0 @@ let data,

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