bare-console
Advanced tools
Comparing version 3.1.0 to 3.1.1
50
index.js
@@ -21,27 +21,7 @@ const inspect = require('bare-inspect') | ||
log (...args) { | ||
let out = '' | ||
let first = true | ||
for (const arg of args) { | ||
if (first) first = false | ||
else out += ' ' | ||
out += typeof arg === 'string' ? arg : inspect(arg, { colors: this._colors }) | ||
} | ||
this._stdout.write(out + '\n') | ||
this._stdout.write(formatArgs(args) + '\n') | ||
} | ||
error (...args) { | ||
let out = '' | ||
let first = true | ||
for (const arg of args) { | ||
if (first) first = false | ||
else out += ' ' | ||
out += typeof arg === 'string' ? arg : inspect(arg, { colors: this._colors }) | ||
} | ||
this._stderr.write(out + '\n') | ||
this._stderr.write(formatArgs(args) + '\n') | ||
} | ||
@@ -74,10 +54,6 @@ | ||
trace (...messages) { | ||
const { stack } = new Error() | ||
const first = stack.indexOf('\n') | ||
const second = stack.indexOf('\n', first + 1) | ||
const start = second > -1 ? second : 0 | ||
this.error('Trace: ' + messages.join(' ') + stack.slice(start)) | ||
trace (...args) { | ||
const err = { name: 'Trace', message: formatArgs(args) } | ||
Error.captureStackTrace(err, this.trace) | ||
this.error(err.stack) | ||
} | ||
@@ -89,1 +65,15 @@ } | ||
} | ||
function formatArgs (args) { | ||
let out = '' | ||
let first = true | ||
for (const arg of args) { | ||
if (first) first = false | ||
else out += ' ' | ||
out += typeof arg === 'string' ? arg : inspect(arg, { colors: this._colors }) | ||
} | ||
return out | ||
} |
{ | ||
"name": "bare-console", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Simple debugging console for JavaScript", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"bare-inspect": "^1.0.0" | ||
"bare-inspect": "^1.1.0" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
14277
59
Updatedbare-inspect@^1.1.0