root / HServer / 00.Server / 00.Program / node_modules / brace-expansion / README.md
이력 | 보기 | 이력해설 | 다운로드 (3.96 KB)
| 1 | 39 | HKM | # brace-expansion |
|---|---|---|---|
| 2 | |||
| 3 | [Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), |
||
| 4 | as known from sh/bash, in JavaScript. |
||
| 5 | |||
| 6 | [](http://travis-ci.org/juliangruber/brace-expansion) |
||
| 7 | [](https://www.npmjs.org/package/brace-expansion) |
||
| 8 | [](https://greenkeeper.io/) |
||
| 9 | |||
| 10 | [](https://ci.testling.com/juliangruber/brace-expansion) |
||
| 11 | |||
| 12 | ## Example |
||
| 13 | |||
| 14 | ```js |
||
| 15 | var expand = require('brace-expansion');
|
||
| 16 | |||
| 17 | expand('file-{a,b,c}.jpg')
|
||
| 18 | // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] |
||
| 19 | |||
| 20 | expand('-v{,,}')
|
||
| 21 | // => ['-v', '-v', '-v'] |
||
| 22 | |||
| 23 | expand('file{0..2}.jpg')
|
||
| 24 | // => ['file0.jpg', 'file1.jpg', 'file2.jpg'] |
||
| 25 | |||
| 26 | expand('file-{a..c}.jpg')
|
||
| 27 | // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] |
||
| 28 | |||
| 29 | expand('file{2..0}.jpg')
|
||
| 30 | // => ['file2.jpg', 'file1.jpg', 'file0.jpg'] |
||
| 31 | |||
| 32 | expand('file{0..4..2}.jpg')
|
||
| 33 | // => ['file0.jpg', 'file2.jpg', 'file4.jpg'] |
||
| 34 | |||
| 35 | expand('file-{a..e..2}.jpg')
|
||
| 36 | // => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] |
||
| 37 | |||
| 38 | expand('file{00..10..5}.jpg')
|
||
| 39 | // => ['file00.jpg', 'file05.jpg', 'file10.jpg'] |
||
| 40 | |||
| 41 | expand('{{A..C},{a..c}}')
|
||
| 42 | // => ['A', 'B', 'C', 'a', 'b', 'c'] |
||
| 43 | |||
| 44 | expand('ppp{,config,oe{,conf}}')
|
||
| 45 | // => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] |
||
| 46 | ``` |
||
| 47 | |||
| 48 | ## API |
||
| 49 | |||
| 50 | ```js |
||
| 51 | var expand = require('brace-expansion');
|
||
| 52 | ``` |
||
| 53 | |||
| 54 | ### var expanded = expand(str) |
||
| 55 | |||
| 56 | Return an array of all possible and valid expansions of `str`. If none are |
||
| 57 | found, `[str]` is returned. |
||
| 58 | |||
| 59 | Valid expansions are: |
||
| 60 | |||
| 61 | ```js |
||
| 62 | /^(.*,)+(.+)?$/ |
||
| 63 | // {a,b,...}
|
||
| 64 | ``` |
||
| 65 | |||
| 66 | A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||
| 67 | |||
| 68 | ```js |
||
| 69 | /^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ |
||
| 70 | // {x..y[..incr]}
|
||
| 71 | ``` |
||
| 72 | |||
| 73 | A numeric sequence from `x` to `y` inclusive, with optional increment. |
||
| 74 | If `x` or `y` start with a leading `0`, all the numbers will be padded |
||
| 75 | to have equal length. Negative numbers and backwards iteration work too. |
||
| 76 | |||
| 77 | ```js |
||
| 78 | /^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ |
||
| 79 | // {x..y[..incr]}
|
||
| 80 | ``` |
||
| 81 | |||
| 82 | An alphabetic sequence from `x` to `y` inclusive, with optional increment. |
||
| 83 | `x` and `y` must be exactly one character, and if given, `incr` must be a |
||
| 84 | number. |
||
| 85 | |||
| 86 | For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||
| 87 | |||
| 88 | ## Installation |
||
| 89 | |||
| 90 | With [npm](https://npmjs.org) do: |
||
| 91 | |||
| 92 | ```bash |
||
| 93 | npm install brace-expansion |
||
| 94 | ``` |
||
| 95 | |||
| 96 | ## Contributors |
||
| 97 | |||
| 98 | - [Julian Gruber](https://github.com/juliangruber) |
||
| 99 | - [Isaac Z. Schlueter](https://github.com/isaacs) |
||
| 100 | |||
| 101 | ## Sponsors |
||
| 102 | |||
| 103 | This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! |
||
| 104 | |||
| 105 | Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! |
||
| 106 | |||
| 107 | ## License |
||
| 108 | |||
| 109 | (MIT) |
||
| 110 | |||
| 111 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> |
||
| 112 | |||
| 113 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
||
| 114 | this software and associated documentation files (the "Software"), to deal in |
||
| 115 | the Software without restriction, including without limitation the rights to |
||
| 116 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
||
| 117 | of the Software, and to permit persons to whom the Software is furnished to do |
||
| 118 | so, subject to the following conditions: |
||
| 119 | |||
| 120 | The above copyright notice and this permission notice shall be included in all |
||
| 121 | copies or substantial portions of the Software. |
||
| 122 | |||
| 123 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||
| 124 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
| 125 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||
| 126 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||
| 127 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||
| 128 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||
| 129 | SOFTWARE. |