normalize-config
Normalize a declarative configuration with any combination of src-dest mappings, files arrays, files objects and options into a consistent format so the config can easily be passed to any build system.
Install
Install with npm:
$ npm i normalize-config --save
Usage
var config = ;
All of the following normalize to the same object:
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
Examples
All of the following:
// src | dest | options; // {src, dest, options}; // {src, dest} | options;
result in:
options: cwd: 'lib' files: options: cwd: 'lib' src: '*.js' dest: 'dist/'
All of the following result in the same object:
;;;//=> { files: [{ src: [ 'lib/*.js' ], dest: 'foo/' }]}
no dest
All of the following result in the same object:
;;;;;;;;//=> {files: [{ src: ['lib/*.js'], dest: ''}]}
with dest
All of the following result in the same object:
;;;;;;//=> {files: [{ src: ['lib/*.js'], dest: 'foo/'}]}
Related projects
- expand-config: Expand tasks, targets and files in a declarative configuration. | homepage
- expand-files: Expand glob patterns in a declarative configuration into src-dest mappings. | homepage
- expand-target: Expand target definitions in a declarative configuration. | homepage
- expand-task: Expand and normalize task definitions in a declarative configuration. | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb on January 05, 2016.