UNPKG

@accounter/shaam6111-generator

Version:

Fully typed application that generates, parses, and validates SHAAM 6111 tax reports.

26 lines (25 loc) 907 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toWindows1255 = toWindows1255; exports.fromWindows1255 = fromWindows1255; const tslib_1 = require("tslib"); const iconv_lite_1 = tslib_1.__importDefault(require("iconv-lite")); /** * Converts a UTF-8 string to a Windows-1255 encoded buffer. * @param input The input string to encode. * @returns A Buffer containing the Windows-1255 encoded data. */ function toWindows1255(input) { if (typeof input !== 'string') { throw new TypeError('Input must be a string'); } return iconv_lite_1.default.encode(input, 'windows-1255'); } /** * Converts a Windows-1255 encoded buffer to a UTF-8 string. * @param buffer The input buffer to decode. * @returns A string decoded from the Windows-1255 buffer. */ function fromWindows1255(buffer) { return iconv_lite_1.default.decode(buffer, 'windows-1255'); }