level-codec
Advanced tools
Comparing version 3.1.0 to 4.0.0
@@ -5,5 +5,6 @@ var encodings = require('./encodings'); | ||
module.exports = function decodeKey(key, optionObjects){ | ||
var encoding = walk(optionObjects, 'keyEncoding') || 'utf8'; | ||
var encoding = walk(optionObjects, 'keyEncoding'); | ||
if (typeof encoding == 'string') encoding = encodings[encoding]; | ||
if (!encoding) return key; | ||
return encoding.decode(key); | ||
}; |
@@ -5,6 +5,7 @@ var encodings = require('./encodings'); | ||
module.exports = function decodeValue(value, optionObjects){ | ||
var encoding = walk(optionObjects, 'valueEncoding') || 'utf8'; | ||
var encoding = walk(optionObjects, 'valueEncoding'); | ||
if (typeof encoding == 'string') encoding = encodings[encoding]; | ||
if (!encoding) return value; | ||
return encoding.decode(value); | ||
}; | ||
@@ -5,5 +5,6 @@ var encodings = require('./encodings'); | ||
module.exports = function encodeKey(key, optionObjects){ | ||
var encoding = walk(optionObjects, 'keyEncoding') || 'utf8'; | ||
var encoding = walk(optionObjects, 'keyEncoding'); | ||
if (typeof encoding == 'string') encoding = encodings[encoding]; | ||
if (!encoding) return key; | ||
return encoding.encode(key); | ||
}; |
@@ -5,6 +5,7 @@ var encodings = require('./encodings'); | ||
module.exports = function encodeValue(value, optionObjects){ | ||
var encoding = walk(optionObjects, 'valueEncoding') || 'utf8'; | ||
var encoding = walk(optionObjects, 'valueEncoding'); | ||
if (typeof encoding == 'string') encoding = encodings[encoding]; | ||
if (!encoding) return value; | ||
return encoding.encode(value); | ||
}; | ||
@@ -5,5 +5,6 @@ var encodings = require('./encodings'); | ||
module.exports = function keyAsBuffer(optionObjects){ | ||
var encoding = walk(optionObjects, 'keyEncoding') || 'utf8'; | ||
var encoding = walk(optionObjects, 'keyEncoding'); | ||
if (typeof encoding == 'string') encoding = encodings[encoding]; | ||
if (!encoding) return false; | ||
return encoding.buffer; | ||
}; |
@@ -5,5 +5,6 @@ var encodings = require('./encodings'); | ||
module.exports = function valueAsBuffer(optionObjects){ | ||
var encoding = walk(optionObjects, 'valueEncoding') || 'utf8'; | ||
var encoding = walk(optionObjects, 'valueEncoding'); | ||
if (typeof encoding == 'string') encoding = encodings[encoding]; | ||
if (!encoding) return false; | ||
return encoding.buffer; | ||
}; |
{ | ||
"name": "level-codec", | ||
"repository": "Level/codec", | ||
"version": "3.1.0", | ||
"version": "4.0.0", | ||
"description": "Levelup's encoding logic", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
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
6416
190