3 [Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
4 as known from sh/bash, in JavaScript.
6 [](http://travis-ci.org/juliangruber/brace-expansion)
8 [](https://ci.testling.com/juliangruber/brace-expansion)
13 var expand = require('brace-expansion');
15 expand('file-{a,b,c}.jpg')
16 // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
19 // => ['-v', '-v', '-v']
21 expand('file{0..2}.jpg')
22 // => ['file0.jpg', 'file1.jpg', 'file2.jpg']
24 expand('file-{a..c}.jpg')
25 // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
27 expand('file{2..0}.jpg')
28 // => ['file2.jpg', 'file1.jpg', 'file0.jpg']
30 expand('file{0..4..2}.jpg')
31 // => ['file0.jpg', 'file2.jpg', 'file4.jpg']
33 expand('file-{a..e..2}.jpg')
34 // => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
36 expand('file{00..10..5}.jpg')
37 // => ['file00.jpg', 'file05.jpg', 'file10.jpg']
39 expand('{{A..C},{a..c}}')
40 // => ['A', 'B', 'C', 'a', 'b', 'c']
42 expand('ppp{,config,oe{,conf}}')
43 // => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
49 var expand = require('brace-expansion');
52 ### var expanded = expand(str)
54 Return an array of all possible and valid expansions of `str`. If none are
55 found, `[str]` is returned.
64 A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
67 /^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
71 A numeric sequence from `x` to `y` inclusive, with optional increment.
72 If `x` or `y` start with a leading `0`, all the numbers will be padded
73 to have equal length. Negative numbers and backwards iteration work too.
76 /^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
80 An alphabetic sequence from `x` to `y` inclusive, with optional increment.
81 `x` and `y` must be exactly one character, and if given, `incr` must be a
84 For compatibility reasons, the string `${` is not eligible for brace expansion.
88 With [npm](https://npmjs.org) do:
91 npm install brace-expansion
96 - [Julian Gruber](https://github.com/juliangruber)
97 - [Isaac Z. Schlueter](https://github.com/isaacs)
103 Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
105 Permission is hereby granted, free of charge, to any person obtaining a copy of
106 this software and associated documentation files (the "Software"), to deal in
107 the Software without restriction, including without limitation the rights to
108 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
109 of the Software, and to permit persons to whom the Software is furnished to do
110 so, subject to the following conditions:
112 The above copyright notice and this permission notice shall be included in all
113 copies or substantial portions of the Software.
115 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
116 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
117 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
118 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
120 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE