Sha256: a6793496036778af8df2cace6632b185a533aa5930ab33c0b89e4e5c81413c7c

Contents?: true

Size: 852 Bytes

Versions: 24

Compression:

Stored size: 852 Bytes

Contents

/* eslint no-param-reassign: off */

module.exports = {
  interpolation(token) {
    let first = token;
    const tokens = [token];
    const validTypes = ['word', '{', '}'];

    token = this.tokenizer.nextToken();

    // look for @{ but not @[word]{
    if (first[1].length > 1 || token[0] !== '{') {
      this.tokenizer.back(token);
      return false;
    }

    while (token && validTypes.includes(token[0])) {
      tokens.push(token);
      token = this.tokenizer.nextToken();
    }

    const words = tokens.map((tokn) => tokn[1]);
    [first] = tokens;
    const last = tokens.pop();
    const start = [first[2], first[3]];
    const end = [last[4] || last[2], last[5] || last[3]];
    const newToken = ['word', words.join('')].concat(start, end);

    this.tokenizer.back(token);
    this.tokenizer.back(newToken);

    return true;
  }
};

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-5.0.7 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-5.0.6 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-5.0.5 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-5.0.4 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-5.0.3 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-5.0.2 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-5.0.1 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.3.5 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-5.0.0 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.3.4 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.3.3 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.3.2 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.3.1 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.3 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.2.3 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.2.2 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.2.1 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.2 node_modules/postcss-less/lib/nodes/interpolation.js
trusty-cms-4.1.9 node_modules/postcss-less/lib/nodes/interpolation.js