Download web/node_modules/braces/lib/stringify.js from Amitkumar001/Law_Slm: direct link, hf CLI and curl.
- Browser
- Download file 708 Bytes
-
https://huggingface.co/Amitkumar001/Law_Slm/resolve/main/web/node_modules/braces/lib/stringify.js
- Command line
-
hf download hf://Amitkumar001/Law_Slm/web/node_modules/braces/lib/stringify.js
-
curl -L -o stringify.js https://huggingface.co/Amitkumar001/Law_Slm/resolve/main/web/node_modules/braces/lib/stringify.js
708 Bytes
| ; | |
| 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); | |
| }; | |