Current Folder
This commit is contained in:
1 parent
8b3382289b
commit
cfcada880d
4379 files changed
No files matched your search
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
import { Coder } from "./abstract-coder";
|
||||
export class BooleanCoder extends Coder {
|
||||
constructor(localName) {
|
||||
super("bool", "bool", localName, false);
|
||||
}
|
||||
encode(writer, value) {
|
||||
return writer.writeValue(value ? 1 : 0);
|
||||
}
|
||||
decode(reader) {
|
||||
return reader.coerce(this.type, !reader.readValue().isZero());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user