2019-08-25 09:39:20 +03:00
|
|
|
"use strict";
|
|
|
|
import { Coder } from "./abstract-coder";
|
|
|
|
export class BooleanCoder extends Coder {
|
|
|
|
constructor(localName) {
|
|
|
|
super("bool", "bool", localName, false);
|
|
|
|
}
|
2020-11-23 11:43:28 +03:00
|
|
|
defaultValue() {
|
|
|
|
return false;
|
|
|
|
}
|
2019-08-25 09:39:20 +03:00
|
|
|
encode(writer, value) {
|
|
|
|
return writer.writeValue(value ? 1 : 0);
|
|
|
|
}
|
|
|
|
decode(reader) {
|
|
|
|
return reader.coerce(this.type, !reader.readValue().isZero());
|
|
|
|
}
|
|
|
|
}
|
2020-07-13 15:03:56 +03:00
|
|
|
//# sourceMappingURL=boolean.js.map
|