ipfs storage for images and other nontext items. for use with etica - runs on etica network and currencys
https://collect.etica-stats.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
612 B
27 lines
612 B
import { Typed } from "../typed.js"; |
|
import { Coder } from "./abstract-coder.js"; |
|
|
|
import type { Reader, Writer } from "./abstract-coder.js"; |
|
|
|
/** |
|
* @_ignore |
|
*/ |
|
export class BooleanCoder extends Coder { |
|
|
|
constructor(localName: string) { |
|
super("bool", "bool", localName, false); |
|
} |
|
|
|
defaultValue(): boolean { |
|
return false; |
|
} |
|
|
|
encode(writer: Writer, _value: boolean | Typed): number { |
|
const value = Typed.dereference(_value, "bool"); |
|
return writer.writeValue(value ? 1: 0); |
|
} |
|
|
|
decode(reader: Reader): any { |
|
return !!reader.readValue(); |
|
} |
|
}
|
|
|