agsamantha/node_modules/form-data-encoder/lib/esm/util/normalizeValue.js
2024-10-02 15:15:21 -05:00

9 lines
276 B
JavaScript

const normalizeValue = (value) => String(value)
.replace(/\r|\n/g, (match, i, str) => {
if ((match === "\r" && str[i + 1] !== "\n")
|| (match === "\n" && str[i - 1] !== "\r")) {
return "\r\n";
}
return match;
});
export default normalizeValue;