level-codec
Advanced tools
@@ -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; | ||
| }; |
+1
-1
| { | ||
| "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", |
6416
1.94%190
3.26%