We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are nested parsers intended to function with the constructor?
The following sample. Parsing from male works, I get a MaleOBJ instance.
male
MaleOBJ
But nesting male in male_nesteda, the constructor is not used.
male_nesteda
const Parser = require("binary-parser").Parser; function MaleOBJ() { this.name = ""; }; MaleOBJ.prototype.toString = function() { return "[object MaleOBJ]"; }; var male = new Parser() .create(MaleOBJ) .string("name", { zeroTerminated: true }); var nested_malea = new Parser() .string("other_name", { zeroTerminated: true }) .nest("other", { type: male }); var buffer = Buffer.from("Alpha male\0John Doe\0"); var denested = male.parse(buffer); console.log(typeof denested); console.log(denested); var nesteda = nested_malea.parse(buffer); console.log(typeof nesteda); console.log(nesteda);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Are nested parsers intended to function with the constructor?
The following sample. Parsing from
male
works, I get aMaleOBJ
instance.But nesting
male
inmale_nesteda
, the constructor is not used.The text was updated successfully, but these errors were encountered: