Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/forivall/glob-pair
https://github.com/forivall/glob-pair
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/forivall/glob-pair
- Owner: forivall
- License: isc
- Created: 2016-02-14T23:44:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T19:30:33.000Z (2 months ago)
- Last Synced: 2024-10-27T12:23:26.051Z (2 months ago)
- Language: JavaScript
- Size: 66.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 58
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# glob-pair
Create source to destination mappings from globs. Geared toward usage for simple
CLI build tools. Created for [tacoscript].[![build status](https://secure.travis-ci.org/forivall/glob-pair.svg)](http://travis-ci.org/forivall/glob-pair)
[![dependency status](https://david-dm.org/forivall/glob-pair.svg)](https://david-dm.org/forivall/glob-pair)## Installation
```
npm install --save glob-pair
```## Usage
Works similar to [lodash.zip](https://lodash.com/docs#zip), but with globs.
Except, if one value is given for the dest, all of the src values will be mapped
to it.When multiple values are submitted for "dest", the same number of values must be
the "src" array.```js
import globPair from "glob-pair";globPair({src: ["*.scss"], dest: ["."], destExt: ".css"}, (src, dest) => {
console.log(src, '->', dest); // a.scss -> a.css
}, (err) => {
console.log(err || "Done!");
})globPair({src: ["lib"], dest: ["dist"]}, (src, dest) => {
console.log(src, '->', dest); // lib/index.js -> dist/lib/index.js
}, (err) => {
console.log(err || "Done!");
})globPair({src: ["src/*"], dest: ["lib"]}, (src, dest) => {
console.log(src, '->', dest); // src/index.js -> lib/index.js
}, (err) => {
console.log(err || "Done!");
})
```## Credits
[Jordan Klassen](https://github.com/forivall/)## Related modules
[expand-files]: Performs a similar function, but is more geared toward json
configuration | [homepage](https://github.com/jonschlinkert/expand-files)## License
ISC
[tacoscript]: https://github.com/forivall/tacoscript
[expand-files]: https://www.npmjs.com/package/expand-files