ccxt
Version:
27 lines (24 loc) • 767 B
JavaScript
// ----------------------------------------------------------------------------
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
import { Typed } from "../typed.js";
import { Coder } from "./abstract-coder.js";
/**
* @_ignore
*/
export class BooleanCoder extends Coder {
constructor(localName) {
super("bool", "bool", localName, false);
}
defaultValue() {
return false;
}
encode(writer, _value) {
const value = Typed.dereference(_value, "bool");
return writer.writeValue(value ? 1 : 0);
}
decode(reader) {
return !!reader.readValue();
}
}