UNPKG

susyweb

Version:

Sophon JavaScript API, middleware to talk to a sophon node over RPC

30 lines (25 loc) 708 B
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;