normalizeValue.js 356 B

1234567891011
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const normalizeValue = (value) => String(value)
  4. .replace(/\r|\n/g, (match, i, str) => {
  5. if ((match === "\r" && str[i + 1] !== "\n")
  6. || (match === "\n" && str[i - 1] !== "\r")) {
  7. return "\r\n";
  8. }
  9. return match;
  10. });
  11. exports.default = normalizeValue;