trim.cjs 274 B

1234567
  1. 'use strict';
  2. function trimSVG(str) {
  3. return str.replace(/(['"])\s*\n\s*([^>\\/\s])/g, "$1 $2").replace(/(["';{}><])\s*\n\s*/g, "$1").replace(/\s*\n\s*/g, " ").replace(/\s+"/g, '"').replace(/="\s+/g, '="').replace(/(\s)+\/>/g, "/>").trim();
  4. }
  5. exports.trimSVG = trimSVG;