(obj, opt)
| 2175 | var { hasOwnProperty: hasOwnProperty2 } = Object.prototype; |
| 2176 | var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n"; |
| 2177 | var encode3 = (obj, opt) => { |
| 2178 | const children = []; |
| 2179 | let out = ""; |
| 2180 | if (typeof opt === "string") { |
| 2181 | opt = { |
| 2182 | section: opt, |
| 2183 | whitespace: false |
| 2184 | }; |
| 2185 | } else { |
| 2186 | opt = opt || /* @__PURE__ */ Object.create(null); |
| 2187 | opt.whitespace = opt.whitespace === true; |
| 2188 | } |
| 2189 | const separator = opt.whitespace ? " = " : "="; |
| 2190 | for (const k7 of Object.keys(obj)) { |
| 2191 | const val = obj[k7]; |
| 2192 | if (val && Array.isArray(val)) { |
| 2193 | for (const item of val) { |
| 2194 | out += safe(k7 + "[]") + separator + safe(item) + eol; |
| 2195 | } |
| 2196 | } else if (val && typeof val === "object") { |
| 2197 | children.push(k7); |
| 2198 | } else { |
| 2199 | out += safe(k7) + separator + safe(val) + eol; |
| 2200 | } |
| 2201 | } |
| 2202 | if (opt.section && out.length) { |
| 2203 | out = "[" + safe(opt.section) + "]" + eol + out; |
| 2204 | } |
| 2205 | for (const k7 of children) { |
| 2206 | const nk = dotSplit(k7).join("\\."); |
| 2207 | const section = (opt.section ? opt.section + "." : "") + nk; |
| 2208 | const { whitespace } = opt; |
| 2209 | const child = encode3(obj[k7], { |
| 2210 | section, |
| 2211 | whitespace |
| 2212 | }); |
| 2213 | if (out.length && child.length) { |
| 2214 | out += eol; |
| 2215 | } |
| 2216 | out += child; |
| 2217 | } |
| 2218 | return out; |
| 2219 | }; |
| 2220 | var dotSplit = (str2) => str2.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map((part) => part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, "")); |
| 2221 | var decode = (str2) => { |
| 2222 | const out = /* @__PURE__ */ Object.create(null); |
no test coverage detected
searching dependent graphs…