File size: 276 Bytes
2c7ab52
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
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;