buffer-codec
Advanced tools
Comparing version 1.5.3 to 1.5.4
@@ -72,3 +72,2 @@ (function() { | ||
if (!aCodecName) { | ||
console.log(arguments.callee.name); | ||
if (isInheritedFrom((aCodecName = arguments.callee.caller), Codec)) { | ||
@@ -135,9 +134,12 @@ try { | ||
Codec.prototype.encodeString = function(value) { | ||
Codec.prototype.encodeString = function(value, bufferEncoding) { | ||
var len; | ||
if (bufferEncoding == null) { | ||
bufferEncoding = 'utf8'; | ||
} | ||
if (this._encodeString) { | ||
return this._encodeString(value); | ||
} else if (this._encodeBuffer) { | ||
len = this._encodeBuffer(value, this.buffer); | ||
return this.buffer.toString(this.bufferEncoding, 0, len); | ||
len = this._encodeBuffer(value, this.buffer, 0); | ||
return this.buffer.toString(bufferEncoding, 0, len); | ||
} else { | ||
@@ -148,4 +150,7 @@ throw new NotImplementedError(); | ||
Codec.prototype.decodeString = function(str) { | ||
Codec.prototype.decodeString = function(str, bufferEncoding) { | ||
var len; | ||
if (bufferEncoding == null) { | ||
bufferEncoding = 'utf8'; | ||
} | ||
if (this._decodeString) { | ||
@@ -155,3 +160,3 @@ return this._decodeString(str); | ||
len = this.buffer.write(str); | ||
return this.decodeBuffer(this.buffer, 0, len); | ||
return this.decodeBuffer(this.buffer, 0, len, bufferEncoding); | ||
} else { | ||
@@ -235,3 +240,3 @@ throw new NotImplementedError(); | ||
} else { | ||
result = this.encodeString(value); | ||
result = this.encodeString(value, options.bufferEncoding); | ||
} | ||
@@ -249,3 +254,3 @@ delete this.options; | ||
} else { | ||
result = this.decodeString(value); | ||
result = this.decodeString(value, options.bufferEncoding); | ||
} | ||
@@ -252,0 +257,0 @@ delete this.options; |
{ | ||
"name": "buffer-codec", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "add the codec ability to abstract-nosql database.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/snowyu/node-buffer-codec", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
98570
904