# 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.

Latest version **0.4.8** (published 2016-01-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install normalize-config
pnpm add normalize-config
yarn add normalize-config
bun add normalize-config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.8 |
| Published | 2016-01-06 |
| First published | 2014-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert, doowb |
| Keywords | config, configuration, dest, destination, expand, files, files array, files object, normalize, options, src, src-dest, target, task |

## Links

- npm: https://www.npmjs.com/package/normalize-config
- Repository: https://github.com/jonschlinkert/normalize-config
- Issues: https://github.com/jonschlinkert/normalize-config/issues
- npm.io page: https://npm.io/package/normalize-config

## Dependencies (2)

- [kind-of](https://npm.io/package/kind-of.md) ^3.0.2
- [extend-shallow](https://npm.io/package/extend-shallow.md) ^2.0.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.4.8 (latest) — 2016-01-06
- 0.4.7 — 2015-11-12
- 0.4.6 — 2015-11-12
- 0.4.5 — 2015-11-10
- 0.4.4 — 2015-11-06
- 0.4.3 — 2015-10-31
- 0.4.2 — 2015-10-31
- 0.4.1 — 2015-10-29
- 0.4.0 — 2015-09-14
- 0.3.1 — 2014-06-28
- 0.3.0 — 2014-06-22
- 0.2.1 — 2014-04-20
- 0.2.0 — 2014-04-17
- 0.1.0 — 2014-04-07

## README

# normalize-config [![NPM version](https://img.shields.io/npm/v/normalize-config.svg)](https://www.npmjs.com/package/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](https://www.npmjs.com/):

```sh
$ npm i normalize-config --save
```

## Usage

```js
var config = require('normalize-config');
```

All of the following normalize to the same object:

```js
config('*.js', 'dist/')
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
config(['*.js'], 'dist/')
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
config({'dist/': '*.js'})
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
config({'dist/': ['*.js']})
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
config({src: '*.js', dest: 'dist/'})
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
config({src: ['*.js'], dest: 'dist/'})
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
config({files: {'dist/': '*.js'}})
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
config({files: {'dist/': ['*.js']}})
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
config({files: [{'dist/': ['*.js']}]})
//=> { files: [ { src: [ '*.js' ], dest: 'dist/' } ] }
```

## Examples

All of the following:

```js
// src | dest | options
config('*.js', 'dist/', {cwd: 'lib'});

// {src, dest, options}
config({src: '*.js', dest: 'dist/', options: {cwd: 'lib'}});

// {src, dest} | options
config({src: '*.js', dest: 'dist/'}, {cwd: 'lib'});
```

result in:

```js
{ 
  options: { cwd: 'lib' },
  files: [ 
    { options: { cwd: 'lib' }, 
      src: [ '*.js' ], 
      dest: 'dist/' 
    } 
  ]
}
```

All of the following result in the same object:

```js
config('lib/*.js', 'foo/');
config({'foo/': 'lib/*.js'});
config({dest: 'foo/', src: 'lib/*.js'});
//=> { files: [{ src: [ 'lib/*.js' ], dest: 'foo/' }]}
```

**no `dest`**

All of the following result in the same object:

```js
config('lib/*.js');
config(['lib/*.js']);
config({'': 'lib/*.js'});
config({'': ['lib/*.js']});
config({src: 'lib/*.js'});
config({src: ['lib/*.js']});
config({src: 'lib/*.js', dest: ''});
config({src: ['lib/*.js'], dest: ''});
//=> {files: [{ src: ['lib/*.js'], dest: ''}]}
```

**with `dest`**

All of the following result in the same object:

```js
config('lib/*.js', 'foo/');
config(['lib/*.js'], 'foo/');
config({'foo/': 'lib/*.js'});
config({'foo/': ['lib/*.js']});
config({src: ['lib/*.js'], dest: 'foo/'});
config({src: 'lib/*.js', dest: 'foo/'});
//=> {files: [{ src: ['lib/*.js'], dest: 'foo/'}]}
```

## Related projects

* [expand-config](https://www.npmjs.com/package/expand-config): Expand tasks, targets and files in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-config)
* [expand-files](https://www.npmjs.com/package/expand-files): Expand glob patterns in a declarative configuration into src-dest mappings. | [homepage](https://github.com/jonschlinkert/expand-files)
* [expand-target](https://www.npmjs.com/package/expand-target): Expand target definitions in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-target)
* [expand-task](https://www.npmjs.com/package/expand-task): Expand and normalize task definitions in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-task)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/normalize-config/issues/new).

## Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.

***

_This file was generated by [verb](https://github.com/verbose/verb) on January 05, 2016._

---
_Source: https://npm.io/package/normalize-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
