UNPKG

zp-figma-converter

Version:

Convert Figma designs to various code formats

51 lines 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createXmlBuilder = createXmlBuilder; exports.buildXml = buildXml; exports.toString = toString; exports.boolToString = boolToString; const fast_xml_parser_1 = require("fast-xml-parser"); /** * Create and configure XMLBuilder * @returns Configured XMLBuilder */ function createXmlBuilder() { return new fast_xml_parser_1.XMLBuilder({ format: true, ignoreAttributes: false, processEntities: false, suppressEmptyNode: true }); } /** * Convert GameFile structure data to XML string * @param data GameFile data * @returns XML string */ function buildXml(data) { const builder = createXmlBuilder(); return builder.build(data); } /** * Convert data type to string * @param value Value to convert * @returns Result string */ function toString(value) { if (value === undefined || value === null) { return ''; } return value.toString(); } /** * Convert boolean value to 'True' or 'False' string * @param value Boolean value * @returns 'True' or 'False' string */ function boolToString(value) { if (value === undefined) { return ''; } return value ? 'True' : 'False'; } //# sourceMappingURL=xml-utils.js.map