Permalink
Browse files

Other: Added infrastructure for custom wrapping/unwrapping of special…

… types, see #677
  • Loading branch information...
dcodeIO committed Apr 11, 2017
1 parent 3939667 commit 0c6e639d08fdf9be12677bf678563ea631bafb2c
Showing with 14 additions and 2 deletions.
  1. +9 −1 src/common.js
  2. +5 −1 src/type.js
@@ -51,7 +51,15 @@ common("any", {
type: "bytes",
id: 2
}
}
}/*,
options: Object.create({
__fromObject: function(object) {
return this.fromObject(object);
},
__toObject: function(options) {
return this.toObject(options);
}
})*/
}
});
@@ -446,14 +446,18 @@ Type.prototype.setup = function setup() {
types : types,
util : util
});
this.fromObject = this.from = converter.fromObject(this).eof(fullName + "$fromObject", {
this.fromObject = converter.fromObject(this).eof(fullName + "$fromObject", {
types : types,
util : util
});
if (this.options && this.options.__formObject)
this.fromObject = this.options.__formObject.bind({ fromObject: this.fromObject });
this.toObject = converter.toObject(this).eof(fullName + "$toObject", {
types : types,
util : util
});
if (this.options && this.options.__toObject)
this.toObject = this.options.__toObject.bind({ toObject: this.toObject });
return this;
};

0 comments on commit 0c6e639

Please sign in to comment.