Skip to content

Commit

Permalink
clean up examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Apr 1, 2019
1 parent 92ec96d commit f5bf204
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 251 deletions.
20 changes: 0 additions & 20 deletions examples/ast.js

This file was deleted.

13 changes: 0 additions & 13 deletions examples/braces.js

This file was deleted.

7 changes: 0 additions & 7 deletions examples/brackets.js

This file was deleted.

34 changes: 0 additions & 34 deletions examples/comparison.js

This file was deleted.

4 changes: 0 additions & 4 deletions examples/escape.js

This file was deleted.

34 changes: 22 additions & 12 deletions examples/expand.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
'use strict';

var mm = require('minimatch');
var braces = require('..');
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(' ');
};

console.log(braces.expand('a/{b,c}/d'));
//=> [ 'a/b/d', 'a/c/d' ]

var ast = braces.parse('a{b{a,b}}c');
var res = braces.compile(ast, {expand: true});
console.log(res)

console.log(braces.expand('{1..100}{1..100}').length);
console.log(braces.expand('{1..10}{1..10}{1..10}').length);
// 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();
5 changes: 0 additions & 5 deletions examples/extglobs.js

This file was deleted.

12 changes: 0 additions & 12 deletions examples/nested-regex.js

This file was deleted.

49 changes: 0 additions & 49 deletions examples/nested.js

This file was deleted.

26 changes: 0 additions & 26 deletions examples/options.quantifiers.js

This file was deleted.

25 changes: 25 additions & 0 deletions examples/parse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

// const input = 'foo/{a,bar/{b,c},d}';
// const input = 'a/{b,c{x,y}}/d';
// const input = '{{x,y},/{b,c{x,y}d,e}/f}';
// const input = '{{a,b}/{b,c{x,y}d,e}/f,x,z}';
// const input = 'a/{b,c}/d';
// const ast = parse(input);
// console.log(ast)
// console.log(JSON.stringify(ast.queue));
// console.log('EXPECTED:', [ 'a/b/f', 'a/cxd/f', 'a/cyd/f', 'a/e/f' ]);
// console.log(JSON.stringify(ast, null, 2))
// console.log(expand(ast));
// expand(ast);

// const sets = parse('foo/{a/b,{c,d,{x..z},e},f}/bar');
// const sets = parse('{a,{c,d}');
// console.log(sets.nodes[2]);
// console.log(compile(sets));

// const range = parse(']{a..e,z}');
// console.log(range.nodes[2]);
// console.log(braces.expand(']{a..e,z}'))
// console.log(compile(range));
// console.log(parse('[abc]'))
6 changes: 0 additions & 6 deletions examples/paths.js

This file was deleted.

28 changes: 0 additions & 28 deletions examples/readme.js

This file was deleted.

19 changes: 0 additions & 19 deletions examples/regex.js

This file was deleted.

7 changes: 0 additions & 7 deletions examples/sequences-steps.js

This file was deleted.

9 changes: 0 additions & 9 deletions examples/sequences.js

This file was deleted.

0 comments on commit f5bf204

Please sign in to comment.