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