Sha256: 595c06790b4cefa2e47ca3758eb51b9d2db1d5b230260d05a5f80fe777839d3d

Contents?: true

Size: 1.15 KB

Versions: 106

Compression:

Stored size: 1.15 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = cleanJSXElementLiteralChild;
var _index = require("../../builders/generated/index.js");
var _index2 = require("../../index.js");
function cleanJSXElementLiteralChild(child, args) {
  const lines = child.value.split(/\r\n|\n|\r/);
  let lastNonEmptyLine = 0;
  for (let i = 0; i < lines.length; i++) {
    if (/[^ \t]/.exec(lines[i])) {
      lastNonEmptyLine = i;
    }
  }
  let str = "";
  for (let i = 0; i < lines.length; i++) {
    const line = lines[i];
    const isFirstLine = i === 0;
    const isLastLine = i === lines.length - 1;
    const isLastNonEmptyLine = i === lastNonEmptyLine;
    let trimmedLine = line.replace(/\t/g, " ");
    if (!isFirstLine) {
      trimmedLine = trimmedLine.replace(/^ +/, "");
    }
    if (!isLastLine) {
      trimmedLine = trimmedLine.replace(/ +$/, "");
    }
    if (trimmedLine) {
      if (!isLastNonEmptyLine) {
        trimmedLine += " ";
      }
      str += trimmedLine;
    }
  }
  if (str) args.push((0, _index2.inherits)((0, _index.stringLiteral)(str), child));
}

//# sourceMappingURL=cleanJSXElementLiteralChild.js.map

Version data entries

106 entries across 7 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-computed-properties/node_modules/@babel/template/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-classes/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.49 node_modules/@babel/helpers/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.49 node_modules/@babel/helper-wrap-function/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.49 node_modules/@babel/helper-remap-async-to-generator/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-async-generator-functions/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.49 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/helper-remap-async-to-generator/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/helper-wrap-function/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/helpers/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-async-generator-functions/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-classes/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-classes/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-computed-properties/node_modules/@babel/template/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-modules-systemjs/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js