-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92ec96d
commit f5bf204
Showing
16 changed files
with
47 additions
and
251 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]')) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.