Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@filerobot/utils / lib / provideSvgStrWithCurrColor.js
Size: Mime:
var provideSvgStrWithCurrColor = function provideSvgStrWithCurrColor(svgString) {
  var preparedSvgString = svgString.replaceAll(/(<\?xml.*?>|<!--.*-->)[\r\n]?/gi, '');
  var startOfSvgTagIndex = preparedSvgString.indexOf('<svg');
  // we are checking start of the tag first for making sure we would catch the first end after the svg opening to avoid issues.
  var endOfSvgTagIndex = startOfSvgTagIndex + preparedSvgString.substr(startOfSvgTagIndex).indexOf('>');
  var svgTagWithPreparedColor = "".concat(preparedSvgString.substr(0, endOfSvgTagIndex).replace(/\s*(?:fill|stroke|color)[:=]\s*['"]?.*['"; }]/i, '').trim(), " color=\"currentColor\" fill=\"currentColor\"");
  var restOfSvgElementPreparedColor = preparedSvgString.substr(endOfSvgTagIndex, preparedSvgString.length).replaceAll(/(\s*(?:fill|stroke|color)[:=]\s*['"]?)#?\b(?!\s*?none).+?([\r\n'";})])/gi, '$1currentColor$2').replaceAll(/(\n\t|\n|\t)/g, ' ');
  return svgTagWithPreparedColor + restOfSvgElementPreparedColor;
};
export default provideSvgStrWithCurrColor;