minor.
This commit is contained in:
parent
e41a44b9a4
commit
e80785654c
@ -29,6 +29,11 @@ function RBT(location, options) {
|
|||||||
if (!(this instanceof RBT))
|
if (!(this instanceof RBT))
|
||||||
return new RBT(location, options);
|
return new RBT(location, options);
|
||||||
|
|
||||||
|
if (typeof location !== 'string') {
|
||||||
|
options = location;
|
||||||
|
location = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!options)
|
if (!options)
|
||||||
options = {};
|
options = {};
|
||||||
|
|
||||||
@ -804,7 +809,7 @@ RBTNode.prototype.copy = function copy() {
|
|||||||
|
|
||||||
RBTNode.prototype.inspect = function inspect() {
|
RBTNode.prototype.inspect = function inspect() {
|
||||||
return {
|
return {
|
||||||
key: this.key.toString('ascii'),
|
key: stringify(this.key),
|
||||||
value: this.value.toString('hex'),
|
value: this.value.toString('hex'),
|
||||||
color: this.color === RED ? 'red' : 'black',
|
color: this.color === RED ? 'red' : 'black',
|
||||||
left: this.left,
|
left: this.left,
|
||||||
@ -882,7 +887,7 @@ function RBTData(key, value) {
|
|||||||
|
|
||||||
RBTData.prototype.inspect = function inspect() {
|
RBTData.prototype.inspect = function inspect() {
|
||||||
return {
|
return {
|
||||||
key: this.key.toString('ascii'),
|
key: stringify(this.key),
|
||||||
value: this.value.toString('hex')
|
value: this.value.toString('hex')
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1051,7 +1056,7 @@ Iterator.prototype.next = function(callback) {
|
|||||||
value = DUMMY;
|
value = DUMMY;
|
||||||
|
|
||||||
if (this.options.keyAsBuffer === false)
|
if (this.options.keyAsBuffer === false)
|
||||||
key = key.toString('ascii');
|
key = stringify(key);
|
||||||
|
|
||||||
if (this.options.valueAsBuffer === false)
|
if (this.options.valueAsBuffer === false)
|
||||||
value = value.toString('utf8');
|
value = value.toString('utf8');
|
||||||
@ -1112,6 +1117,12 @@ Iterator.prototype.end = function end(callback) {
|
|||||||
|
|
||||||
SENTINEL = new RBTSentinel();
|
SENTINEL = new RBTSentinel();
|
||||||
|
|
||||||
|
function stringify(value) {
|
||||||
|
if (Buffer.isBuffer(value))
|
||||||
|
return value.toString('ascii');
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Expose
|
* Expose
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user