source: imaps-frontend/node_modules/braces/lib/stringify.js@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 708 bytes
Line 
1'use strict';
2
3const utils = require('./utils');
4
5module.exports = (ast, options = {}) => {
6 const stringify = (node, parent = {}) => {
7 const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
8 const invalidNode = node.invalid === true && options.escapeInvalid === true;
9 let output = '';
10
11 if (node.value) {
12 if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
13 return '\\' + node.value;
14 }
15 return node.value;
16 }
17
18 if (node.value) {
19 return node.value;
20 }
21
22 if (node.nodes) {
23 for (const child of node.nodes) {
24 output += stringify(child);
25 }
26 }
27 return output;
28 };
29
30 return stringify(ast);
31};
32
Note: See TracBrowser for help on using the repository browser.