Sha256: 379f22d77bfa1478341ccd49c5e4267464aabcbba03558bab332aac23fc6f23a

Contents?: true

Size: 708 Bytes

Versions: 14

Compression:

Stored size: 708 Bytes

Contents

'use strict';

const utils = require('./utils');

module.exports = (ast, options = {}) => {
  const stringify = (node, parent = {}) => {
    const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
    const invalidNode = node.invalid === true && options.escapeInvalid === true;
    let output = '';

    if (node.value) {
      if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
        return '\\' + node.value;
      }
      return node.value;
    }

    if (node.value) {
      return node.value;
    }

    if (node.nodes) {
      for (const child of node.nodes) {
        output += stringify(child);
      }
    }
    return output;
  };

  return stringify(ast);
};

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.52 node_modules/braces/lib/stringify.js
trusty-cms-6.3.1 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.51 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.50 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.49 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.48 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.47 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.46 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.45 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.44 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.43 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.42 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.41 node_modules/braces/lib/stringify.js
immosquare-cleaner-0.1.40 node_modules/braces/lib/stringify.js