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

@slimio/pretty-stack

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slimio/pretty-stack - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

27

index.js

@@ -51,2 +51,16 @@ "use strict";

/**
* @function getPattern
* @param {!string} line
* @returns {any}
*/
function getPattern(line) {
const result = /at\s(.*)\s\((.*)\)/.exec(line);
if (result !== null) {
return result;
}
return /at\s(.*)/.exec(line);
}
/**
* @function prettyStack

@@ -63,4 +77,5 @@ * @param {!Error} error

console.log("\n " + bgRed(white().bold(` ${arrStack.shift()} `)) + "\n");
// console.log(arrStack);
for (const line of arrStack) {
const result = /at\s(.*)\s\((.*)\)/.exec(line);
const result = getPattern(line);
if (result === null) {

@@ -76,3 +91,3 @@ continue;

path = at;
at = "";
at = null;
}

@@ -83,5 +98,5 @@

console.log(
gray().bold(` o at ${white().bold(at)} (${cyan().bold(fileName)} ${yellow().bold(`at line ${fileLine}`)})`)
);
const linePosition = `${cyan().bold(fileName)} ${yellow().bold(`at line ${fileLine}`)}`;
const lineToLog = at === null ? linePosition : `at ${white().bold(at)} (${linePosition})`;
console.log(gray().bold(` o ${lineToLog}`));
if (!mem.has(fullName)) {

@@ -95,3 +110,3 @@ console.log(gray().bold(` ${path}\n`));

console.log("");
const [, at, path = at] = /at\s(.*)\s\((.*)\)/.exec(firstStack);
const [, at, path = at] = getPattern(firstStack);
const [fileName, line, char] = basename(path).split(":");

@@ -98,0 +113,0 @@

{
"name": "@slimio/pretty-stack",
"version": "0.4.0",
"version": "0.4.1",
"description": "Pretty Stack Trace to stdout in TTY",

@@ -41,11 +41,11 @@ "main": "index.js",

"devDependencies": {
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@escommunity/minami": "^1.0.0",
"@slimio/eslint-config": "^3.0.3",
"@slimio/psp": "^0.7.0",
"ava": "^2.3.0",
"cross-env": "^5.2.0",
"eslint": "^6.3.0",
"husky": "^3.0.4",
"@slimio/eslint-config": "^4.0.0-next.2",
"@slimio/psp": "^0.8.0",
"ava": "^2.4.0",
"cross-env": "^6.0.3",
"eslint": "^6.5.1",
"husky": "^3.0.8",
"jsdoc": "^3.6.3",

@@ -52,0 +52,0 @@ "nyc": "^14.1.1",

# pretty-stack
![version](https://img.shields.io/badge/version-0.1.0-blue.svg)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/SlimIO/is/commit-activity)
![version](https://img.shields.io/badge/dynamic/json.svg?url=https://raw.githubusercontent.com/SlimIO/pretty-stack/master/package.json&query=$.version&label=Version)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/SlimIO/pretty-stack/commit-activity)
![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)
![dep](https://img.shields.io/david/SlimIO/pretty-stack)
![size](https://img.shields.io/github/languages/code-size/SlimIO/pretty-stack)

@@ -30,8 +32,12 @@ Pretty Stack Trace to stdout in TTY. Use clean-stack of sindresorhus under the hood to improve the whole experience.

const err = new Error("hello world!");
prettyStack(err);
prettyStack(err, true);
// or go with the stack array
prettyStack(err.stack, false);
```
## API
TBC
### prettyStack(error: Error | string | string[], printFile?: boolean): void
This method can handle many input types. In case the input is a string it will be splitted by `\n`.
## Dependencies

@@ -38,0 +44,0 @@

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