console-log-it
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,2 +1,6 @@ | ||
## [0.0.2] - 2021-01-14 | ||
- Cleaned up logBox code to make it more concise | ||
- Updated image urls in README.md | ||
## [0.0.1] - 2021-01-13 | ||
- Alpha release |
@@ -84,15 +84,7 @@ "use strict"; | ||
}; | ||
var output = '\n' + indent + (bar === 'bottom' ? corners.bottomLeft : corners.topLeft); | ||
for (var i = 0; i < (padding + width + padding); i++) { | ||
output += _symbol; | ||
} | ||
return output += (bar === 'bottom' ? corners.bottomRight + '\n' : corners.topRight); | ||
var leftCorner = '\n' + indent + (bar === 'bottom' ? corners.bottomLeft : corners.topLeft); | ||
var center = _symbol.repeat(padding + width + padding); | ||
var rightCorner = (bar === 'bottom' ? corners.bottomRight + '\n' : corners.topRight); | ||
return leftCorner + center + rightCorner; | ||
}; | ||
var getPadding = function (padding) { | ||
var output = ''; | ||
for (var i = 0; i < padding; i++) { | ||
output += ' '; | ||
} | ||
return output; | ||
}; | ||
var getLine = function (boxColor, indent, padding, width, line, symbol) { | ||
@@ -102,2 +94,3 @@ var message = typeof line === 'string' ? line : line.message; | ||
var rightPadding = width > message.length ? width - message.length + padding : padding; | ||
var getPadding = function (padding) { return ' '.repeat(padding); }; | ||
if (typeof line === 'object') { | ||
@@ -108,57 +101,1 @@ return '\n' + indent + _symbol + getPadding(padding) + index_1.colorNoResetMap.get(line.color) + message + boxColor + getPadding(rightPadding) + _symbol; | ||
}; | ||
// export const logBox = (config?: LogBoxConfig) => (message: string[] | string | LogBoxLine[]) : void => { | ||
// const lines = typeof message === 'string' ? [message] : message; | ||
// const indent = typeof config?.indent === 'number' ? ' '.repeat(config.indent) : ''; | ||
// const padding = config?.padding !== undefined ? config.padding : 2; | ||
// const color = config?.color !== undefined ? colorMap.get(config.color) : colorMap.get('cyan'); | ||
// const symbol = config?.symbol !== undefined && config.symbol.length > 0 ? config.symbol : undefined; | ||
// const width = getTextWidth(lines); | ||
// console.log(color, getBorder('top', indent, padding, width, symbol)); | ||
// if (config && config.bufferLines) { | ||
// console.log(color, getLine(indent, padding, width, '', symbol)); | ||
// } | ||
// for (const line of lines) { | ||
// console.log(color, getLine(indent, padding, width, line, symbol)); | ||
// } | ||
// if (config && config.bufferLines) { | ||
// console.log(color, getLine(indent, padding, width, '', symbol)); | ||
// } | ||
// console.log(color, getBorder('bottom', indent, padding, width, symbol)); | ||
// console.log(); | ||
// }; | ||
// const getTextWidth = (lines: string[] | LogBoxLine[]) : number => { | ||
// let width = 0; | ||
// lines.forEach(x => { | ||
// if (x.length > width) { | ||
// width = x.length; | ||
// } | ||
// }); | ||
// return width; | ||
// }; | ||
// const getBorder = (bar: string, indent, padding: number, width: number, symbol?: string) => { | ||
// const _symbol = symbol ? symbol.substring(0, 1) : '─'; | ||
// const corners = { | ||
// topLeft: symbol ? symbol.substring(0, 1) : '╭', | ||
// topRight: symbol ? symbol.substring(0, 1) : '╮', | ||
// bottomLeft: symbol ? symbol.substring(0, 1) : '╰', | ||
// bottomRight: symbol ? symbol.substring(0, 1) : '╯', | ||
// }; | ||
// let output = indent + (bar === 'bottom' ? corners.bottomLeft : corners.topLeft); | ||
// for (let i = 0; i < (padding + width + padding); i++) { | ||
// output += _symbol; | ||
// } | ||
// return output += (bar === 'bottom' ? corners.bottomRight : corners.topRight); | ||
// }; | ||
// const getPadding = (padding: number) : string => { | ||
// let output = ''; | ||
// for (let i = 0; i < padding; i++) { | ||
// output += ' '; | ||
// } | ||
// return output; | ||
// }; | ||
// const getLine = (indent, padding:number, width: number, line: string | LogBoxLine, symbol?: string) : string => { | ||
// const message = typeof line === 'string' ? line : line.message; | ||
// const _symbol = symbol ? symbol.substring(0, 1) : '│'; | ||
// const rightPadding = width > message.length ? width - message.length + padding : padding; | ||
// return indent + _symbol + getPadding(padding) + message + getPadding(rightPadding) + _symbol; | ||
// }; |
@@ -80,15 +80,7 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
}; | ||
var output = '\n' + indent + (bar === 'bottom' ? corners.bottomLeft : corners.topLeft); | ||
for (var i = 0; i < (padding + width + padding); i++) { | ||
output += _symbol; | ||
} | ||
return output += (bar === 'bottom' ? corners.bottomRight + '\n' : corners.topRight); | ||
var leftCorner = '\n' + indent + (bar === 'bottom' ? corners.bottomLeft : corners.topLeft); | ||
var center = _symbol.repeat(padding + width + padding); | ||
var rightCorner = (bar === 'bottom' ? corners.bottomRight + '\n' : corners.topRight); | ||
return leftCorner + center + rightCorner; | ||
}; | ||
var getPadding = function (padding) { | ||
var output = ''; | ||
for (var i = 0; i < padding; i++) { | ||
output += ' '; | ||
} | ||
return output; | ||
}; | ||
var getLine = function (boxColor, indent, padding, width, line, symbol) { | ||
@@ -98,2 +90,3 @@ var message = typeof line === 'string' ? line : line.message; | ||
var rightPadding = width > message.length ? width - message.length + padding : padding; | ||
var getPadding = function (padding) { return ' '.repeat(padding); }; | ||
if (typeof line === 'object') { | ||
@@ -104,57 +97,1 @@ return '\n' + indent + _symbol + getPadding(padding) + colorNoResetMap.get(line.color) + message + boxColor + getPadding(rightPadding) + _symbol; | ||
}; | ||
// export const logBox = (config?: LogBoxConfig) => (message: string[] | string | LogBoxLine[]) : void => { | ||
// const lines = typeof message === 'string' ? [message] : message; | ||
// const indent = typeof config?.indent === 'number' ? ' '.repeat(config.indent) : ''; | ||
// const padding = config?.padding !== undefined ? config.padding : 2; | ||
// const color = config?.color !== undefined ? colorMap.get(config.color) : colorMap.get('cyan'); | ||
// const symbol = config?.symbol !== undefined && config.symbol.length > 0 ? config.symbol : undefined; | ||
// const width = getTextWidth(lines); | ||
// console.log(color, getBorder('top', indent, padding, width, symbol)); | ||
// if (config && config.bufferLines) { | ||
// console.log(color, getLine(indent, padding, width, '', symbol)); | ||
// } | ||
// for (const line of lines) { | ||
// console.log(color, getLine(indent, padding, width, line, symbol)); | ||
// } | ||
// if (config && config.bufferLines) { | ||
// console.log(color, getLine(indent, padding, width, '', symbol)); | ||
// } | ||
// console.log(color, getBorder('bottom', indent, padding, width, symbol)); | ||
// console.log(); | ||
// }; | ||
// const getTextWidth = (lines: string[] | LogBoxLine[]) : number => { | ||
// let width = 0; | ||
// lines.forEach(x => { | ||
// if (x.length > width) { | ||
// width = x.length; | ||
// } | ||
// }); | ||
// return width; | ||
// }; | ||
// const getBorder = (bar: string, indent, padding: number, width: number, symbol?: string) => { | ||
// const _symbol = symbol ? symbol.substring(0, 1) : '─'; | ||
// const corners = { | ||
// topLeft: symbol ? symbol.substring(0, 1) : '╭', | ||
// topRight: symbol ? symbol.substring(0, 1) : '╮', | ||
// bottomLeft: symbol ? symbol.substring(0, 1) : '╰', | ||
// bottomRight: symbol ? symbol.substring(0, 1) : '╯', | ||
// }; | ||
// let output = indent + (bar === 'bottom' ? corners.bottomLeft : corners.topLeft); | ||
// for (let i = 0; i < (padding + width + padding); i++) { | ||
// output += _symbol; | ||
// } | ||
// return output += (bar === 'bottom' ? corners.bottomRight : corners.topRight); | ||
// }; | ||
// const getPadding = (padding: number) : string => { | ||
// let output = ''; | ||
// for (let i = 0; i < padding; i++) { | ||
// output += ' '; | ||
// } | ||
// return output; | ||
// }; | ||
// const getLine = (indent, padding:number, width: number, line: string | LogBoxLine, symbol?: string) : string => { | ||
// const message = typeof line === 'string' ? line : line.message; | ||
// const _symbol = symbol ? symbol.substring(0, 1) : '│'; | ||
// const rightPadding = width > message.length ? width - message.length + padding : padding; | ||
// return indent + _symbol + getPadding(padding) + message + getPadding(rightPadding) + _symbol; | ||
// }; |
{ | ||
"name": "console-log-it", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Console log colors, boxes, and more for the browser and terminal", | ||
@@ -5,0 +5,0 @@ "main": "lib/es5/index.js", |
@@ -10,10 +10,8 @@ [![Build Status](https://travis-ci.com/TheSpicyMeatball/console-log-it.svg?branch=main)](https://travis-ci.com/TheSpicyMeatball/console-log-it) | ||
<p><b>Version:</b> 0.0.1</p> | ||
<p><b>Version:</b> 0.0.2</p> | ||
<h2>Summary of Utils</h2> | ||
> Click on each function name for details and examples | ||
<h2>Summary of Utils</h2> | ||
<p>For detailed information on each util, see below this table.</p> | ||
<table> | ||
@@ -34,11 +32,11 @@ <thead> | ||
![Status Logs](images/boxes.png) | ||
![Status Logs](https://github.com/TheSpicyMeatball/console-log-it/blob/main/dist/images/boxes.png?raw=true) | ||
<h3>Core & Custom Statuses</h3> | ||
![Status Logs](images/status-logs.png) | ||
![Status Logs](https://github.com/TheSpicyMeatball/console-log-it/blob/main/dist/images/status-logs.png?raw=true) | ||
<h3>Change Your Line Style</h3> | ||
![Status Logs](images/style.png) | ||
![Status Logs](https://github.com/TheSpicyMeatball/console-log-it/blob/main/dist/images/style.png?raw=true) | ||
@@ -96,3 +94,3 @@ <h2>Interfaces & Types</h2> | ||
└───index.d.ts - 1.04 KB | ||
└───index.js - 7.24 KB | ||
└───index.js - 4.53 KB | ||
└───/logDebug | ||
@@ -130,3 +128,3 @@ └───index.d.ts - 519 Bytes | ||
└───index.d.ts - 1.04 KB | ||
└───index.js - 7.1 KB | ||
└───index.js - 4.39 KB | ||
└───/logDebug | ||
@@ -133,0 +131,0 @@ └───index.d.ts - 519 Bytes |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133071
1085
174