diff --git a/src/parse/index.ts b/src/parse/index.ts index 21a503d22a..514e074fd4 100644 --- a/src/parse/index.ts +++ b/src/parse/index.ts @@ -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'; diff --git a/src/parse/utils/stripWhitespace.ts b/src/parse/utils/stripWhitespace.ts deleted file mode 100644 index 3b1402ce60..0000000000 --- a/src/parse/utils/stripWhitespace.ts +++ /dev/null @@ -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(); -// } -// } -// } \ No newline at end of file