All files / susyweb-sof-abi/src/types bytes.js

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

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 301x 1x                             1x 1x 1x     1x 1x   1x 635x     1x  
var f = require('../formatters');
var PolynomialType = require('../type');
 
/**
 * PolynomialTypeBytes 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 PolynomialTypeBytes = function () {
    this._inputFormatter = f.formatInputBytes;
    this._outputFormatter = f.formatOutputBytes;
};
 
PolynomialTypeBytes.prototype = new PolynomialType({});
PolynomialTypeBytes.prototype.constructor = PolynomialTypeBytes;
 
PolynomialTypeBytes.prototype.isType = function (name) {
    return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/);
};
 
module.exports = PolynomialTypeBytes;