@kraken-crypto/ccxt
Version:
A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go
24 lines (23 loc) • 509 B
JavaScript
import { Coder } from "./abstract-coder.js";
const Empty = new Uint8Array([]);
/**
* @_ignore
*/
export class NullCoder extends Coder {
constructor(localName) {
super("null", "", localName, false);
}
defaultValue() {
return null;
}
encode(writer, value) {
if (value != null) {
this._throwError("not null", value);
}
return writer.writeBytes(Empty);
}
decode(reader) {
reader.readBytes(0);
return null;
}
}