Comparing version 0.9.25 to 0.9.26
@@ -23,6 +23,12 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var canRequire = require('./lib/can-require.js'); | ||
var hex = null; | ||
// istanbul ignore if | ||
if (canRequire('hexer')) { | ||
hex = require('hexer'); | ||
} | ||
var color = require('ansi-color').set; | ||
var stripColor = require('./lib/strip_color.js'); | ||
var extend = require('xtend'); | ||
var hex = require('hexer'); | ||
var stripColor = require('hexer/render').stripColor; | ||
var inspect = require('util').inspect; | ||
@@ -294,2 +300,8 @@ | ||
var self = this; | ||
// istanbul ignore if | ||
if (!hex) { | ||
return self.buffer.toString('hex'); | ||
} | ||
options = extend(options, { | ||
@@ -296,0 +308,0 @@ emptyHuman: ' ', |
@@ -24,3 +24,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var color = require('ansi-color').set; | ||
var render = require('hexer/render'); | ||
var stripColor = require('./lib/strip_color.js'); | ||
@@ -48,8 +48,8 @@ module.exports = errorHighlighter; | ||
within = totalOffset !== err.endOffset-1; | ||
return errColor(render.stripColor(str)); | ||
return errColor(stripColor(str)); | ||
} else if (totalOffset === err.endOffset-1) { | ||
within = false; | ||
return errColor(render.stripColor(str)); | ||
return errColor(stripColor(str)); | ||
} else if (within) { | ||
return errColor(render.stripColor(str)); | ||
return errColor(stripColor(str)); | ||
} else { | ||
@@ -62,3 +62,3 @@ return str; | ||
if (totalOffset === err.offset) { | ||
return errColor(render.stripColor(str)); | ||
return errColor(stripColor(str)); | ||
} else { | ||
@@ -65,0 +65,0 @@ return str; |
@@ -23,3 +23,9 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var hex = require('hexer'); | ||
var canRequire = require('./lib/can-require.js'); | ||
var hex = null; | ||
// istanbul ignore if | ||
if (canRequire('hexer')) { | ||
hex = require('hexer'); | ||
} | ||
var util = require('util'); | ||
@@ -181,2 +187,7 @@ var Result = require('./result'); | ||
function formatBufferColored(err, options) { | ||
// istanbul ignore else | ||
if (!hex) { | ||
return err.buffer.toString('hex'); | ||
} | ||
options = options || {}; | ||
@@ -195,2 +206,7 @@ var opts = options.hexerOptions ? Object.create(options.hexerOptions) : {}; | ||
function formatBufferUncolored(err, options) { | ||
// istanbul ignore else | ||
if (!hex) { | ||
return err.buffer.toString('hex'); | ||
} | ||
options = options || {}; | ||
@@ -197,0 +213,0 @@ |
{ | ||
"name": "bufrw", | ||
"version": "0.9.25", | ||
"version": "0.9.26", | ||
"description": "Buffer Reading and Writing", | ||
@@ -22,4 +22,2 @@ "keywords": [], | ||
"error": "^7.0.0", | ||
"hexer": "^1.4.3", | ||
"readable-stream": "1.0.33", | ||
"xtend": "^4.0.0" | ||
@@ -26,0 +24,0 @@ }, |
@@ -24,3 +24,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var inherits = require('util').inherits; | ||
var Transform = require('readable-stream').Transform; | ||
var Transform = require('stream').Transform; | ||
var ReadMachine = require('./read_machine'); | ||
@@ -27,0 +27,0 @@ |
@@ -25,3 +25,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var inspect = require('util').inspect; | ||
var Transform = require('readable-stream').Transform; | ||
var Transform = require('stream').Transform; | ||
var WrappedError = require('error/wrapped'); | ||
@@ -28,0 +28,0 @@ |
@@ -23,3 +23,9 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var hexdiff = require('hexer/diff'); | ||
var canRequire = require('./lib/can-require.js'); | ||
var hexdiff = null; | ||
// istanbul ignore if | ||
if (canRequire('hexer')) { | ||
hexdiff = require('hexer/diff'); | ||
} | ||
var util = require('util'); | ||
@@ -127,4 +133,7 @@ var formatError = require('./interface').formatError; | ||
// TODO: re-run write with an annotated buffer | ||
self.assert.comment('expected v actual:\n' + | ||
hexdiff(buf, got, {colored: true})); | ||
// istanbul ignore if | ||
if (hexdiff) { | ||
self.assert.comment('expected v actual:\n' + | ||
hexdiff(buf, got, {colored: true})); | ||
} | ||
self.assert.fail(desc); | ||
@@ -131,0 +140,0 @@ } else { |
@@ -23,3 +23,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var PassThrough = require('readable-stream').PassThrough; | ||
var PassThrough = require('stream').PassThrough; | ||
var util = require('util'); | ||
@@ -26,0 +26,0 @@ |
@@ -23,3 +23,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var PassThrough = require('readable-stream').PassThrough; | ||
var PassThrough = require('stream').PassThrough; | ||
var util = require('util'); | ||
@@ -26,0 +26,0 @@ |
@@ -79,4 +79,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
'write error BangError: bang'); | ||
assert.equal(results[3], | ||
'00\x1b[36m:\x1b[0m \x1b[31m\x1b[1m00\x1b[0m \x1b[31m\x1b[1m.\x1b[0m'); | ||
assert.equal(results[3], '00'); | ||
@@ -88,4 +87,3 @@ assert.equal(results[4].name, 'no read error', 'expected "no read error"'); | ||
'read error Error: bork'); | ||
assert.equal(results[6], | ||
'00\x1b[36m:\x1b[0m \x1b[31m\x1b[1m00\x1b[0m \x1b[31m\x1b[1m.\x1b[0m'); | ||
assert.equal(results[6], '00'); | ||
@@ -92,0 +90,0 @@ assert.end(); |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
173904
3
54
4371
2
- Removedhexer@^1.4.3
- Removedreadable-stream@1.0.33
- Removedcore-util-is@1.0.3(transitive)
- Removedhexer@1.5.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@0.0.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedprocess@0.10.1(transitive)
- Removedreadable-stream@1.0.33(transitive)
- Removedstring_decoder@0.10.31(transitive)