braces
Fastest brace expansion lib. Typically used with file paths, but can be used with any string. Expands comma-separated values (e.g. foo/{a,b,c}/bar
) and alphabetical or numerical ranges (e.g. {1..9}
)
Benchmarks
node benchmark
Example usage
var expand = require('braces');
expand('a/{x,y}/c{d}e')
expand('a/b/c/{x,y}')
expand('a/{x,{1..5},y}/c{d}e')
See the examples and tests to see more use cases.
Range expansion
Uses expand-range for range expansion.
expand('a{1..3}b')
expand('a{5..8}b')
expand('a{00..05}b')
expand('a{01..03}b')
expand('a{000..005}b')
expand('a{a..e}b')
expand('a{A..E}b')
Pass a function as the last argument to customize range expansions:
var range = expand('x{a..e}y', function (str, i) {
return String.fromCharCode(str) + i;
});
console.log(range);
See expand-range for benchmarks, tests and information related to expanding ranges.
Install
Install with npm
npm i braces --save
Run tests
npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
This file was generated by verb on November 23, 2014.