capnp-js
Version:
Capnproto run-time decoding and encoding for Node
16 lines (15 loc) • 482 B
JavaScript
var fields = require('./fields');
module.exports = function(Type) {
var has = fields.pointer.has();
Type._FIELD.has = function(offset) {
return function() {
return has(this, offset);
};
};
Type._FIELD.unionHas = function(discr, offset) {
return function() {
fields.throwOnInactive(this.which(), discr);
return has(this, offset);
};
};
};