diff --git a/src/utils/converters.util.ts b/src/utils/converters.util.ts new file mode 100644 index 0000000..dc96289 --- /dev/null +++ b/src/utils/converters.util.ts @@ -0,0 +1,12 @@ +const ConvertersUtils = { + toUpperCase: (str: string) => String(str).toUpperCase(), + toLowerCase: (str: string) => String(str).toLowerCase(), + bufferToBool: (buf: ArrayBuffer) => { + return new Uint8Array(buf)[0] !== 0; + }, + boolToBuffer: (bol: boolean) => { + return new Uint8Array([bol ? 1 : 0]).buffer; + } +} + +export default ConvertersUtils; \ No newline at end of file