descargar pdf y fotos

This commit is contained in:
2026-06-09 08:25:57 -05:00
parent 0a9c672c75
commit b19deda02c
4404 changed files with 664668 additions and 84 deletions
+43
View File
@@ -0,0 +1,43 @@
class Optional {
constructor(type, condition = true) {
this.type = type;
this.condition = condition;
}
decode(stream, parent) {
let { condition } = this;
if (typeof condition === 'function') {
condition = condition.call(parent, parent);
}
if (condition) {
return this.type.decode(stream, parent);
}
}
size(val, parent) {
let { condition } = this;
if (typeof condition === 'function') {
condition = condition.call(parent, parent);
}
if (condition) {
return this.type.size(val, parent);
} else {
return 0;
}
}
encode(stream, val, parent) {
let { condition } = this;
if (typeof condition === 'function') {
condition = condition.call(parent, parent);
}
if (condition) {
return this.type.encode(stream, val, parent);
}
}
}
module.exports = Optional;