glob-pair

2.0.1 • Public • Published

glob-pair

Create source to destination mappings from globs. Geared toward usage for simple CLI build tools. Created for tacoscript.

build status dependency status

Installation

npm install --save glob-pair

Usage

Works similar to lodash.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.

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

Related modules

expand-files: Performs a similar function, but is more geared toward json configuration | homepage

License

ISC

Readme

Keywords

none

Package Sidebar

Install

npm i glob-pair

Weekly Downloads

1

Version

2.0.1

License

ISC

Last publish

Collaborators

  • forivall