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

@scaffdog/error

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scaffdog/error - npm Package Compare versions

Comparing version 1.0.0-canary.0 to 1.0.0-canary.1

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

# [1.0.0-canary.1](https://github.com/cats-oss/scaffdog/compare/v1.0.0-canary.0...v1.0.0-canary.1) (2021-01-12)
### Features
- improve error message ([4b66723](https://github.com/cats-oss/scaffdog/commit/4b667232ecd6cef7e33a145e7d0f35e8afb2fb81))
# [1.0.0-canary.0](https://github.com/cats-oss/scaffdog/compare/v0.3.0...v1.0.0-canary.0) (2021-01-11)

@@ -8,0 +14,0 @@

8

lib/index.d.ts

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

export declare type ErrorLoc = {
line: number;
column: number;
};
import type { SourceLocation } from '@scaffdog/types';
export declare type ScaffdogErrorOptions = {
source: string;
start: ErrorLoc;
end: ErrorLoc;
loc: SourceLocation;
color: boolean;

@@ -10,0 +6,0 @@ };

@@ -16,7 +16,6 @@ "use strict";

};
if (opts.source && opts.start && opts.end) {
if (opts.source && opts.loc) {
this.message = this._format(message, {
source: opts.source,
start: opts.start,
end: opts.end,
loc: opts.loc,
color: !!opts.color,

@@ -45,15 +44,16 @@ });

line.substring(e);
const base = Math.max(options.start.line - 3, 0);
const base = Math.max(options.loc.start.line - 3, 0);
const lines = options.source.split(NEWLINE);
lines.splice(0, base);
lines.splice(options.end.line - options.start.line + 5);
lines.splice(options.loc.end.line - options.loc.start.line + 5);
const start = {
line: options.start.line - 1 - base,
column: options.start.column,
line: options.loc.start.line - 1 - base,
column: options.loc.start.column,
};
const end = {
line: options.end.line - 1 - base,
column: options.end.column,
line: options.loc.end.line - 1 - base,
column: options.loc.end.column,
};
const output = [];
const output = [` ${red(`${message}:`)}`, ''];
const gutter = chk.gray('│');
lines.forEach((line, index) => {

@@ -67,9 +67,11 @@ if (start.line <= index && index <= end.line) {

};
output.push(emphasis(line, col.start, col.end), space(col.start - 1) + mark(col.end - col.start + 1));
output.push(` ${red('>')} ${gutter} ` + emphasis(line, col.start, col.end), ` ${gutter} ` +
space(col.start - 1) +
mark(col.end - col.start + 1));
}
else {
output.push(line);
output.push(` ${gutter} ${line}`);
}
});
return [`${red(message)}:`, output.join('\n')].join('\n\n');
return output.join('\n');
}

@@ -76,0 +78,0 @@ }

{
"name": "@scaffdog/error",
"version": "1.0.0-canary.0",
"version": "1.0.0-canary.1",
"description": "A utility module of scaffdog error.",

@@ -34,6 +34,9 @@ "keywords": [

},
"devDependencies": {
"@scaffdog/types": "1.0.0-canary.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "87ed8ec940b3cff7c1a5eedb49271e96b56c8978"
"gitHead": "b7221e4a15338cd73ba8c963edf32339b915b255"
}
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