remove unused code

pull/676/head
Rich Harris 8 years ago
parent c98e1f49d3
commit 94166f60d8

@ -4,7 +4,6 @@ import { whitespace } from '../utils/patterns';
import { trimStart, trimEnd } from '../utils/trim';
import getCodeFrame from '../utils/getCodeFrame';
import hash from './utils/hash';
import stripWhitespace from './utils/stripWhitespace';
import { Node, Parsed } from '../interfaces';
import CompileError from '../utils/CompileError';

@ -1,52 +0,0 @@
import { trimStart, trimEnd } from '../../utils/trim';
import { Node } from '../../interfaces';
export default function stripWhitespace(nodes: Node[]) {
while (nodes.length) {
const firstChild = nodes[0];
if (firstChild.type !== 'Text') break;
const length = firstChild.data.length;
firstChild.data = trimStart(firstChild.data);
if (firstChild.data === '') {
nodes.shift();
} else {
break;
}
}
while (nodes.length) {
const lastChild = nodes[nodes.length - 1];
if (lastChild.type !== 'Text') break;
const length = lastChild.data.length;
lastChild.data = trimEnd(lastChild.data);
if (lastChild.data === '') {
nodes.pop();
} else {
break;
}
}
}
// function stripWhitespace(element) {
// if (element.children.length) {
// const firstChild = element.children[0];
// const lastChild = element.children[element.children.length - 1];
// if (firstChild.type === 'Text') {
// firstChild.data = trimStart(firstChild.data);
// if (!firstChild.data) element.children.shift();
// }
// if (lastChild.type === 'Text') {
// lastChild.data = trimEnd(lastChild.data);
// if (!lastChild.data) element.children.pop();
// }
// }
// }
Loading…
Cancel
Save