"use strict";
exports.__esModule = true;
exports.isReactComponent = undefined;
exports.isCompatTag = isCompatTag;
exports.buildChildren = buildChildren;
var _index = require("./index");
var t = _interopRequireWildcard(_index);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var isReactComponent = exports.isReactComponent = t.buildMatchMemberExpression("React.Component");
function isCompatTag(tagName) {
return !!tagName && /^[a-z]|\-/.test(tagName);
}
function cleanJSXElementLiteralChild(child, args) {
var lines = child.value.split(/\r\n|\n|\r/);
var lastNonEmptyLine = 0;
for (var i = 0; i < lines.length; i++) {
if (lines[i].match(/[^ \t]/)) {
lastNonEmptyLine = i;
}
}
var str = "";
for (var _i = 0; _i < lines.length; _i++) {
var line = lines[_i];
var isFirstLine = _i === 0;
var isLastLine = _i === lines.length - 1;
var isLastNonEmptyLine = _i === lastNonEmptyLine;
var 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(t.stringLiteral(str));
}
function buildChildren(node) {
var elems = [];
for (var i = 0; i < node.children.length; i++) {
var child = node.children[i];
if (t.isJSXText(child)) {
cleanJSXElementLiteralChild(child, elems);
continue;
}
if (t.isJSXExpressionContainer(child)) child = child.expression;
if (t.isJSXEmptyExpression(child)) continue;
elems.push(child);
}
return elems;
}
# |
Change |
User |
Description |
Committed |
|
#1
|
23539 |
jenbottom |
Adding the basic code for ember test appk, created with 'ember new' command |
|
|