# all files / packages/web3-eth-abi/src/types/ bytes.js

100% Statements 10/10
100% Branches 0/0
100% Functions 2/2
100% Lines 10/10

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    301×
    1×

    1×
    1×
    1×

    1×
    1×

    1×
    395×

    1×
     var f = require('./formatters');
    var SolidityType = require('./type');

    /**
     * SolidityTypeBytes is a prototype that represents the bytes type.
     * It matches:
     * bytes
     * bytes[]
     * bytes[4]
     * bytes[][]
     * bytes[3][]
     * bytes[][6][], ...
     * bytes32
     * bytes8[4]
     * bytes[3][]
     */
    var SolidityTypeBytes = function () {
        this._inputFormatter = f.formatInputBytes;
        this._outputFormatter = f.formatOutputBytes;
    };

    SolidityTypeBytes.prototype = new SolidityType({});
    SolidityTypeBytes.prototype.constructor = SolidityTypeBytes;

    SolidityTypeBytes.prototype.isType = function (name) {
        return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/);
    };

    module.exports = SolidityTypeBytes;