Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { decode, encode, Stream } from 'amp';
// $ExpectType Buffer[]
decode(new Buffer('something'));
// $ExpectType Buffer
encode([new Buffer('something'), new Buffer('something')]);
// $ExpectError
decode('');
// $ExpectError
decode(1);
// $ExpectError
decode();
// $ExpectError
encode('');
import { decode, encode, Stream } from 'amp';
// $ExpectType Buffer[]
decode(new Buffer('something'));
// $ExpectType Buffer
encode([new Buffer('something'), new Buffer('something')]);
// $ExpectError
decode('');
// $ExpectError
decode(1);
// $ExpectError
decode();
// $ExpectError
encode('');
// $ExpectError
encode(1);
// $ExpectError
encode();
import { decode, encode, Stream } from 'amp';
// $ExpectType Buffer[]
decode(new Buffer('something'));
// $ExpectType Buffer
encode([new Buffer('something'), new Buffer('something')]);
// $ExpectError
decode('');
// $ExpectError
decode(1);
// $ExpectError
decode();
// $ExpectError
encode('');
// $ExpectError
encode(1);
// $ExpectError
encode();
// $ExpectType Stream
new Stream({});
function decode(msg) {
var args = amp.decode(msg);
for (var i = 0; i < args.length; i++) {
args[i] = unpack(args[i]);
}
return args;
}
static decode(buffer) { return amp.decode(buffer) }