4.6.135 • Published 10 months ago

@patrtorg/magnam-aut-adipisci v4.6.135

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@patrtorg/magnam-aut-adipisci

Brace expansion, as known from sh/bash, in JavaScript.

CI downloads

Example

import expand from '@patrtorg/magnam-aut-adipisci'

expand('file-{a,b,c}.jpg')
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']

expand('-v{,,}')
// => ['-v', '-v', '-v']

expand('file{0..2}.jpg')
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']

expand('file-{a..c}.jpg')
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']

expand('file{2..0}.jpg')
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']

expand('file{0..4..2}.jpg')
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']

expand('file-{a..e..2}.jpg')
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']

expand('file{00..10..5}.jpg')
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']

expand('{{A..C},{a..c}}')
// => ['A', 'B', 'C', 'a', 'b', 'c']

expand('ppp{,config,oe{,conf}}')
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']

API

import expand from '@patrtorg/magnam-aut-adipisci'

const expanded = expand(str)

Return an array of all possible and valid expansions of str. If none are found, [str] is returned.

Valid expansions are:

/^(.*,)+(.+)?$/
// {a,b,...}

A comma separated list of options, like {a,b} or {a,{b,c}} or {,a,}.

/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
// {x..y[..incr]}

A numeric sequence from x to y inclusive, with optional increment. If x or y start with a leading 0, all the numbers will be padded to have equal length. Negative numbers and backwards iteration work too.

/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
// {x..y[..incr]}

An alphabetic sequence from x to y inclusive, with optional increment. x and y must be exactly one character, and if given, incr must be a number.

For compatibility reasons, the string ${ is not eligible for brace expansion.

Installation

With npm do:

npm install @patrtorg/magnam-aut-adipisci

Contributors

Sponsors

This module is proudly supported by my Sponsors!

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. Not sure how much of my modules you're using? Try feross/thanks!

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

License

(MIT)

Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

limiterrorlesscssemittypesafeamazonemojiworkspace:*TypeScriptArrayInt16Arrayfromnegative zerodebugHyBinumbercollectioniamformsdeep-clonetyped arrayless compilerString.prototype.matchAllbeanstalkmatchAllprotobufcensorieYAMLgetasyncJSONtoobjectglobchaitimeFloat64ArrayenumerablestringifymoveregexpInt8ArraysetImmediatemergeasciiterminaleslintconfigvpcstdlibmulti-packagelocationartES2018less.jsqueueMicrotaskmapreduceendpointbyteECMAScript 2016jsxbundlingstarter__proto__livesetPrototypeOfextracjkcallboundes6climinimaltestingloadingSymboliterateauthbreakloggernodejsbatchstablemimewgetcss lessredactformattingimmeres2018routingequalrecursiveStreamsform-validationdom-testing-librarydeep-copyqueryreduxes7positiveinstallObject.fromEntriestelephonespinnerseveryURLsidewraptypedwhichECMAScript 2021ECMAScript 2017debuggerexecduplexstreamsperformanceArray.prototype.filtercode pointsES2016configrandomavathroat$.extendslot256matchesregexjsdomrangeerroryupsyntaxpackagesmruString.prototype.trimreact-testing-librarymobileentriesarraytapes3loggingreadablesyntaxerrorinstallerES5cloudwatches5computed-typescollection.es6trimStartcall-boundObservablevalueansiclonegetoptelasticacheprivateobjdefinePropertymochaObject.valuesserializationJSON-Schemaec2pnpm9parserfastES2015arraysObject.keyses8trimEndaccessibilityfindLastcurlgroupByES2021loadbalancingdeleteES2019filecompilertseslintiteratorbyteOffset0es-abstractcolorsisConcatSpreadableCSSStyleDeclarationbrowserclientstringmime-dbencryptiondeepcopycssbootstrap cssfseventsECMAScript 2015zodstatelessglacierescapeimmutableObject.getPrototypeOfcloudfrontworkflowdotenvless cssflagemrvalidationAsyncIteratorconcatMapsearchstylesheetuninstallhasStreamSetgroupTypedArrayecmascriptexpresseslintpluginjsdiffUint32ArrayfastcloneMicrosoftfast-cloneconsumeefficientargparsetoSortedweaksetrequestthrottledatalintbddprefixfastcopyrapidarraybuffergetterclassnamesoptimisttc39eslint-pluginECMAScript 7lockfilewarningspeedIteratorsqstrimcommandregular expressiontddES2023postcss-pluginRegExp.prototype.flagsfind-upnativehooksshebangvalidatestylecoercibleoffsetratelimiteast-asian-widthtapfile systemhigher-orderfast-deep-cloneoptionReactiveXES7Reflect.getPrototypeOfregularvestcolumnsrmdirjapanesetypeerrorUint8ClampedArraydescriptorgetintrinsicvariables in cssgenericspatchbuffershasOwnPropertyschemeutilitieswalkingpackage.jsonInt32ArraysymbolsURLSearchParamsflatbrowserslistcacheArray.prototype.flatvariablespasswordnametouchebsSymbol.toStringTagclassnamemkdirsjsoncompile lessjsboundbluebirdautoprefixertesteronceauthenticationbuffersharedarraybuffergraphqlES8typeofmakeponyfillrobustRxJSreuselessjQuerygetPrototypeOffullwidthdescriptionreadmatchqsdatastructurefetchtypanionArrayBuffer#sliceeventEmitterintrinsickeyiskoreancolorlastenvWebSocketsfast-copyECMAScript 2018argstostringtaginlimiteddeepclonewritableECMAScript 2019ES2022routecryptotaskshamcreateutil.inspectrgbtypedarraysquoteinferenceapollostreamcallbindcss nestingajaxstylesnamesoptimizertextprettydependenciestslibawesomesaucenested cssfpsvisualsafeArray.prototype.findLastObject.assignwatchFiletypesxhrconcatprivate datamonorepocommanderuuidcloudsearch_.extendESjasminestreams2performantrdsajvairbnbflattenremoveawsgetOwnPropertyDescriptorswfenderescommand-lineObjecthotestreemetadata-0route53runtimesymlinksstyleguideobjectbindes2016pipeFloat32ArraydescriptorscryptsequenceWebSocketworkerenvironmentpluginsesgdprpicomatchwritehasOwnbusyargveventDispatcheres-shimsa11yhelperssymbolutiltypescriptfindlibphonenumbersuperagentjavascriptArray.prototype.includesastscheme-validationchannelunicodeflatMapmoduleforEachformatkarmaratereadablestreamvaluespushwordwrapstringifierquerystringinspectsimpledbreact-hook-formchromiumassertionurlrmcheckassignsortlistenersimportexporttypeconcurrencyreducerhas-ownweakmappredictablecoreutilitynegativelruPushwafomitgradients css3containssortedmake dirCSSrm -rfshimfinduppropertyawaitspinnerWeakSetObject.definePropertyformpropES3elmstateprunecopycharacterterminternal slotfunctionalcallbackpackage managerwalksuperstructrfc4122ES6noperegular expressionsMapPromisejsonpathpromiseRxwaitsnsserializeECMAScript 6elblookcallES2017class-validatordeterministicwatcherproxywatchlogwatchingArray.prototype.flatMappostcssinvariantlinkdynamodbkinesistypedarrayFunction.prototype.namespecexpressioncloudformationconfigurableUint8Arraycloudtrailincludessettingsfunctionaccessorhashfolderpackagecors
@patrtorg/numquam-doloribus-sit@patrtorg/doloribus-aperiam@patrtorg/dolorum-blanditiis@patrtorg/dolorum-quisquam-molestias@patrtorg/eaque-tempore-temporibus@patrtorg/ducimus-hic@patrtorg/eaque-dolorem-iusto@patrtorg/enim-culpa@patrtorg/enim-quas@patrtorg/est-corrupti@patrtorg/error-expedita-rerum@patrtorg/esse-ut@patrtorg/esse-occaecati-quos@patrtorg/ex-iure@patrtorg/expedita-deleniti-ratione@patrtorg/expedita-eaque-at@patrtorg/fugiat-beatae-quas@patrtorg/fugiat-perspiciatis@patrtorg/fugit-cumque@patrtorg/illo-saepe@patrtorg/hic-facere-ratione@patrtorg/itaque-beatae@patrtorg/iste-sunt@patrtorg/iure-at@patrtorg/labore-nemo-impedit@patrtorg/molestiae-nulla-architecto@patrtorg/modi-aut-dolorem@patrtorg/modi-officia-iusto@patrtorg/nihil-at@patrtorg/nihil-vero-ipsa@patrtorg/pariatur-sapiente@patrtorg/quia-laborum-porro@patrtorg/qui-dolore@patrtorg/quidem-dolore@patrtorg/qui-omnis-voluptates@patrtorg/similique-nam@patrtorg/sed-laudantium-nemo@patrtorg/sapiente-sed-eius@patrtorg/sed-veritatis-placeat@patrtorg/soluta-quo@patrtorg/nisi-perferendis@patrtorg/perspiciatis-possimus@patrtorg/quo-cupiditate-sit@patrtorg/saepe-tenetur-iusto@patrtorg/repellendus-ex@patrtorg/repudiandae-dolore@patrtorg/repellat-quam@patrtorg/tempora-quas@patrtorg/tempore-cumque@patrtorg/vero-quibusdam-ipsa@patrtorg/maiores-adipisci-maxime@patrtorg/nostrum-beatae-a@patrtorg/nobis-assumenda-optio@patrtorg/nobis-nobis@patrtorg/quas-sed-id@patrtorg/reiciendis-doloribus-officia@patrtorg/soluta-numquam@patrtorg/soluta-et@patrtorg/neque-consectetur@patrtorg/neque-voluptatem@patrtorg/odit-facere@patrtorg/officiis-qui@patrtorg/odio-ratione@patrtorg/officiis-dolorum@patrtorg/quos-hic@patrtorg/similique-vero-sapiente@patrtorg/sit-ipsam-dolore@patrtorg/suscipit-sit-culpa@patrtorg/tempora-impedit-dolore@patrtorg/porro-voluptates@patrtorg/quod-asperiores@patrtorg/tenetur-aut@patrtorg/tempore-labore-mollitia@patrtorg/totam-accusamus@patrtorg/veritatis-vel-amet@patrtorg/veritatis-ad-voluptates@patrtorg/occaecati-reiciendis-reiciendis@patrtorg/pariatur-repellendus-aspernatur@patrtorg/quo-in@patrtorg/sunt-distinctio-illo@patrtorg/sunt-asperiores@patrtorg/ullam-eum@patrtorg/ullam-doloremque@patrtorg/unde-cupiditate@patrtorg/animi-laboriosam-adipisci@patrtorg/aperiam-quaerat@patrtorg/aspernatur-assumenda@patrtorg/aspernatur-dolorum-ducimus@patrtorg/architecto-laudantium@patrtorg/aspernatur-repellendus-assumenda@patrtorg/assumenda-officia@patrtorg/assumenda-qui@patrtorg/assumenda-ipsam@patrtorg/aspernatur-laborum@patrtorg/at-sunt-itaque@patrtorg/commodi-illo@patrtorg/beatae-quas@patrtorg/blanditiis-ea-quaerat@patrtorg/blanditiis-quibusdam-sit@patrtorg/consectetur-odio-placeat
4.6.134

10 months ago

4.6.135

10 months ago

4.6.133

10 months ago

3.3.79

12 months ago

4.5.111

11 months ago

1.1.39

1 year ago

3.3.82

12 months ago

3.3.83

12 months ago

3.3.84

12 months ago

3.3.85

12 months ago

3.3.86

12 months ago

3.3.87

12 months ago

3.3.88

11 months ago

3.3.89

11 months ago

2.2.68

1 year ago

1.1.41

1 year ago

2.2.69

1 year ago

1.1.40

1 year ago

3.3.80

12 months ago

2.2.66

1 year ago

3.3.81

12 months ago

2.2.67

1 year ago

2.2.64

1 year ago

1.1.45

1 year ago

2.2.65

1 year ago

1.1.44

1 year ago

1.1.43

1 year ago

1.1.42

1 year ago

1.1.49

1 year ago

1.1.48

1 year ago

1.1.47

1 year ago

1.1.46

1 year ago

1.0.39

1 year ago

1.0.38

1 year ago

4.3.104

11 months ago

2.2.71

12 months ago

2.2.72

12 months ago

2.2.70

12 months ago

1.0.19

1 year ago

1.0.18

1 year ago

3.3.101

11 months ago

1.0.17

1 year ago

1.0.16

1 year ago

3.3.100

11 months ago

4.6.118

10 months ago

4.6.119

10 months ago

4.6.116

10 months ago

4.6.117

10 months ago

4.6.114

10 months ago

4.6.115

10 months ago

4.6.112

11 months ago

4.6.113

11 months ago

4.6.121

10 months ago

4.6.122

10 months ago

4.6.120

10 months ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

3.2.79

12 months ago

3.2.78

12 months ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

4.3.101

11 months ago

4.3.102

11 months ago

4.3.103

11 months ago

3.2.73

12 months ago

3.2.72

12 months ago

3.2.75

12 months ago

3.2.74

12 months ago

3.2.77

12 months ago

3.2.76

12 months ago

4.6.111

11 months ago

2.1.58

1 year ago

2.1.59

1 year ago

2.1.56

1 year ago

2.1.57

1 year ago

2.1.54

1 year ago

2.1.55

1 year ago

2.1.52

1 year ago

1.0.33

1 year ago

2.1.53

1 year ago

1.0.32

1 year ago

2.1.50

1 year ago

1.0.31

1 year ago

2.1.51

1 year ago

1.0.30

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

4.4.105

11 months ago

3.3.93

11 months ago

4.4.106

11 months ago

3.3.94

11 months ago

3.3.95

11 months ago

4.4.104

11 months ago

3.3.96

11 months ago

4.4.109

11 months ago

3.3.97

11 months ago

3.3.98

11 months ago

4.4.107

11 months ago

3.3.99

11 months ago

4.4.108

11 months ago

3.3.90

11 months ago

4.4.110

11 months ago

3.3.91

11 months ago

1.1.50

1 year ago

4.4.111

11 months ago

3.3.92

11 months ago

2.1.63

1 year ago

2.1.64

1 year ago

2.1.61

1 year ago

2.1.62

1 year ago

2.1.60

1 year ago

4.6.129

10 months ago

4.6.127

10 months ago

4.6.128

10 months ago

4.6.125

10 months ago

4.6.126

10 months ago

4.6.123

10 months ago

4.6.124

10 months ago

4.6.132

10 months ago

4.6.130

10 months ago

4.6.131

10 months ago

1.0.15

1 year ago

1.0.11

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago