How to use the bitsyntax.parse function in bitsyntax

To help you get started, we’ve selected a few bitsyntax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github noodlefrenzy / node-amqp10 / test / amqp_types.js View on Github external
it('bitsyntax parser 2', function() {
        var buffer = new Buffer([0xA1, 0x3, 0x46, 0x4F, 0x4F]);
        var parser = bitsyntax.parse('161:8, len:8, value:len/binary, rest/binary');
        var matcher = bitsyntax.match(parser, buffer);
        matcher.should.be.ok;
        matcher.value.should.eql(new Buffer([0x46, 0x4F, 0x4F]));
    });
    it('should spit right version', function() {
github noodlefrenzy / node-amqp10 / test / amqp_types.js View on Github external
it('bitsyntax parser', function() {
        var expected = new Buffer([0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80]);
        var buffer = new Buffer([0x80, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80]);
        var parser = bitsyntax.parse('128:8, value:8/binary, rest/binary');
        var matcher = bitsyntax.match(parser, buffer);
        matcher.should.be.ok;
        matcher.value.should.eql(expected);
    });
    it('bitsyntax parser 2', function() {

bitsyntax

Pattern-matching on byte buffers

MIT
Latest version published 6 years ago

Package Health Score

53 / 100
Full package analysis