| Server IP : 74.208.250.37 / Your IP : 216.73.216.114 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/doc/node-braces/examples/ |
Upload File : |
const colors = require('ansi-colors');
const parse = require('./parse');
const color = (arr, c) => arr.map(s => c(s)).join(', ');
const cp = require('child_process');
const braces = input => {
return cp.execSync(`echo ${input}`).toString().trim().split(' ');
};
// const fixture = '{a,{b,c},d}';
// const fixture = '{a,b}{c,d}{e,f}';
// const fixture = 'a/{b,c{x,y}d,e}/f';
// const fixture = '{{a,b}/i,j,k}';
// const fixture = '{c,d{e,f}g,h}';
// const fixture = '{{c,d{e,f}g,h}/i,j,k}';
// const fixture = '{a,b}/{c,d{e,f}g,h}';
// const fixture = '{{a,b}/{c,d{e,f}g,h}/i,j,k}';
// const fixture = '{x,y,{a,b,c\\}}';
const fixture = 'a{,b}c';
console.log();
console.log(' FIXTURE:', colors.magenta(fixture));
console.log(' ACTUAL:', color(expand(parse(fixture)), colors.yellow));
console.log('EXPECTED:', color(braces(fixture), colors.blue));
console.log();