Sha256: 49a027bc8785d92397987ef6104db8095c0fd456c77d75582a774bac5aa831b4
Contents?: true
Size: 948 Bytes
Versions: 24
Compression:
Stored size: 948 Bytes
Contents
"use strict"; const tokenize = require("postcss/lib/tokenize"); function templateTokenize () { const tokenizer = tokenize.apply(this, arguments); function nextToken () { const args = arguments; const returned = []; let token; let depth = 0; let line; let column; while ((token = tokenizer.nextToken.apply(tokenizer, args))) { if (token[0] !== "word") { if (token[0] === "{") { ++depth; } else if (token[0] === "}") { --depth; } } if (depth || returned.length) { line = token[4] || token[2] || line; column = token[5] || token[3] || column; returned.push(token); } if (!depth) { break; } } if (returned.length) { token = [ "word", returned.map(token => token[1]).join(""), returned[0][2], returned[0][3], line, column, ]; } return token; } return Object.assign({}, tokenizer, { nextToken, }); } module.exports = templateTokenize;
Version data entries
24 entries across 24 versions & 1 rubygems