Socket
Socket
Sign inDemoInstall

level-codec

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-codec - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

4

index.js

@@ -18,3 +18,3 @@ var encodings = require('./lib/encodings');

return this._encoding(batchOpts && batchOpts.keyEncoding
|| opts.keyEncoding
|| opts && opts.keyEncoding
|| this.opts.keyEncoding);

@@ -25,3 +25,3 @@ };

return this._encoding(batchOpts && batchOpts.valueEncoding
|| opts.valueEncoding
|| opts && opts.valueEncoding
|| this.opts.valueEncoding);

@@ -28,0 +28,0 @@ };

{
"name": "level-codec",
"repository": "Level/codec",
"version": "5.0.0",
"version": "5.1.0",
"description": "Levelup's encoding logic",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -22,27 +22,27 @@

### #encodeKey(key, opts)
### #encodeKey(key[, opts])
Encode `key` with given `opts`.
### #encodeValue(value, opts)
### #encodeValue(value[, opts])
Encode `value` with given `opts`.
### #encodeBatch(batch, opts)
### #encodeBatch(batch[, opts])
Encode `batch` ops with given `opts`.
### #decodeKey(key, opts)
### #decodeKey(key[, opts])
Decode `key` with given `opts`.
### #decodeValue(value, opts)
### #decodeValue(value[, opts])
Decode `value` with given `opts`.
### #keyAsBuffer(opts)
### #keyAsBuffer([opts])
Check whether `opts` and the global `opts` call for a binary key encoding.
### #valueAsBuffer(opts)
### #valueAsBuffer([opts])

@@ -49,0 +49,0 @@ Check whether `opts` and the global `opts` call for a binary value encoding.

@@ -7,2 +7,3 @@ var test = require('tape');

t.ok(codec.keyAsBuffer({}));
t.ok(codec.keyAsBuffer());
t.notOk(codec.keyAsBuffer({ keyEncoding: 'utf8' }));

@@ -15,2 +16,3 @@ t.end();

t.ok(codec.valueAsBuffer({}));
t.ok(codec.valueAsBuffer());
t.notOk(codec.valueAsBuffer({ valueEncoding: 'utf8' }));

@@ -17,0 +19,0 @@ t.end();

@@ -21,4 +21,10 @@ var test = require('tape');

encoded = codec.encodeBatch(ops);
t.deepEqual(encoded, [
{ type: 'put', key: 'string', value: 'string' },
{ type: 'put', key: 'json', value: {} }
]);
t.end();
});

@@ -10,2 +10,5 @@ var test = require('tape');

buf = codec.encodeKey('686579');
t.equal(buf.toString(), 'hey');
buf = codec.encodeKey('686579', {

@@ -25,2 +28,5 @@ keyEncoding: 'binary'

buf = codec.encodeValue('686579');
t.equal(buf.toString(), 'hey');
buf = codec.encodeValue('686579', {

@@ -40,2 +46,5 @@ valueEncoding: 'binary'

buf = codec.decodeKey(new Buffer('hey'));
t.equal(buf, '686579');
buf = codec.decodeKey(new Buffer('hey'), {

@@ -55,2 +64,5 @@ keyEncoding: 'binary'

buf = codec.decodeValue(new Buffer('hey'));
t.equal(buf, '686579');
buf = codec.decodeValue(new Buffer('hey'), {

@@ -57,0 +69,0 @@ valueEncoding: 'binary'

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc