Sha256: 4a9e3160e90f3a213929a1f3c572d24f5398f80a4dbf445f03008a2306a734a9

Contents?: true

Size: 1.01 KB

Versions: 15

Compression:

Stored size: 1.01 KB

Contents

(function() {
  var brackets, last;

  last = function(array) {
    return array[array.length - 1];
  };

  brackets = {
    parse: function(str) {
      var current, j, len, stack, sym;
      current = [''];
      stack = [current];
      for (j = 0, len = str.length; j < len; j++) {
        sym = str[j];
        if (sym === '(') {
          current = [''];
          last(stack).push(current);
          stack.push(current);
        } else if (sym === ')') {
          stack.pop();
          current = last(stack);
          current.push('');
        } else {
          current[current.length - 1] += sym;
        }
      }
      return stack[0];
    },
    stringify: function(ast) {
      var i, j, len, result;
      result = '';
      for (j = 0, len = ast.length; j < len; j++) {
        i = ast[j];
        if (typeof i === 'object') {
          result += '(' + brackets.stringify(i) + ')';
        } else {
          result += i;
        }
      }
      return result;
    }
  };

  module.exports = brackets;

}).call(this);

Version data entries

15 entries across 15 versions & 7 rubygems

Version Path
ilog-0.4.1 node_modules/autoprefixer/lib/brackets.js
ilog-0.4.0 node_modules/autoprefixer/lib/brackets.js
ilog-0.3.3 node_modules/autoprefixer/lib/brackets.js
optimacms-0.4.3 spec/dummy/node_modules/autoprefixer/lib/brackets.js
optimacms-0.4.2 spec/dummy/node_modules/autoprefixer/lib/brackets.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/autoprefixer/lib/brackets.js
lux_assets-0.2.11 ./node_modules/autoprefixer/lib/brackets.js
lux_assets-0.2.9 ./node_modules/autoprefixer/lib/brackets.js
lux_assets-0.2.4 ./node_modules/autoprefixer/lib/brackets.js
lux_assets-0.2.2 ./node_modules/autoprefixer/lib/brackets.js
lux_assets-0.2.1 ./node_modules/autoprefixer/lib/brackets.js
locomotivecms-3.4.0 app/javascript/node_modules/autoprefixer/lib/brackets.js
cortex-0.1.3 spec/dummy/node_modules/cssnano/node_modules/autoprefixer/lib/brackets.js
lanes-0.8.0 node_modules/autoprefixer/lib/brackets.js
blackboard-3.1.9 lib/site_template/node_modules/autoprefixer/lib/brackets.js