
Product
Rust Support in Socket Is Now Generally Available
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.
normalize-config
Advanced tools
Normalize a declarative configuration with any combination of src-dest mappings, files arrays, files objects and options into a consistent format. Uses globule to expand glob patterns and rte for dynamically generating destination paths. Inspired by Grunt

Normalize a declarative configuration with any combination of src-dest mappings, files arrays, files objects and options into a consistent format. Uses globule to expand glob patterns and rte for dynamically generating destination paths. Inspired by Grunt's
normalizeMultiTaskFilesmethod.
Install with npm:
npm i normalize-config --save-dev
var normalize = require('normalize-config');
console.log(normalize({files: {'dist/': '*.js'}}));
Dynamically generate destination paths by defining a route property with the structure you want to use for the destination path(s).
Example:
var result = normalize({
options: {
route: 'foo/:dest/:basename.min.js'
},
src: ['*.js'],
dest: 'scripts/'
});
//=> { files: [ { src: [ 'index.js' ], dest: 'foo/scripts/index.min.js' } ] }
See rte for all related options.
All of these:
{files: {'dist/': '*.js'}}
{files: [{src: '*.js', dest: 'dist/'}]}
{src: '*.js', dest: 'dist/'}
{src: ['*.js'], dest: 'dist/'}
Would normalize to:
{files: [{src: ['index.js'], dest: 'dist/'}]}
All of the following:
var normalize = require('normalize-config');
var config = normalize({
options: {
expand: true,
cwd: 'test/fixtures'
},
files: {
'dist/a/': ['a/*.js'],
'dist/b/': ['b/*.js']
}
});
var result = normalize({
options: {
expand: true,
cwd: 'test/fixtures'
},
files: [
{dest: 'dist/a/', src: ['a/*.js']},
{dest: 'dist/b/', src: ['b/*.js']}
]
});
var result = normalize({
options: {
cwd: 'test/fixtures'
},
files: [
{expand: true, dest: 'dist/a/', src: ['a/*.js']},
{expand: true, dest: 'dist/b/', src: ['b/*.js']}
]
});
var result = normalize({
options: {
cwd: 'test/fixtures'
},
files: [
{options: {expand: true}, dest: 'dist/a/', src: ['a/*.js']},
{options: {expand: true}, dest: 'dist/b/', src: ['b/*.js']}
]
});
console.log(config);
Would normalize to the following (see the test fixtures):
{ files:
[ { src: [ 'a/x.js' ],
dest: 'dist/a/a/x.js',
orig:
{ options: { expand: true, cwd: 'test/fixtures' },
src: [ 'a/*.js' ],
dest: 'dist/a/' } },
{ src: [ 'a/y.js' ],
dest: 'dist/a/a/y.js',
orig:
{ options: { expand: true, cwd: 'test/fixtures' },
src: [ 'a/*.js' ],
dest: 'dist/a/' } },
{ src: [ 'b/x.js' ],
dest: 'dist/b/b/x.js',
orig:
{ options: { expand: true, cwd: 'test/fixtures' },
src: [ 'b/*.js' ],
dest: 'dist/b/' } },
{ src: [ 'b/y.js' ],
dest: 'dist/b/b/y.js',
orig:
{ options: { expand: true, cwd: 'test/fixtures' },
src: [ 'b/*.js' ],
dest: 'dist/b/' } },
{ src: [ 'b/z.js' ],
dest: 'dist/b/b/z.js',
orig:
{ options: { expand: true, cwd: 'test/fixtures' },
src: [ 'b/*.js' ],
dest: 'dist/b/' } } ] }
Normalize any combination of files arrays, files objects, src-dest pairings and options.
Example:
normalize({src: '*.js', dest: 'dist/'});
Params:
config {Object}: The config object to be normalized.return{Object}Normlize a config object with multiple files definitions.
Params:
config {Object}options {Object}return{Object}Normalize src, dest and options definitions to an array of files objects.
Params:
config {Object}return{Object}Normalize files objects with varied formats to an array of files objects.
Params:
config {Object}return{Object}Options are passed to globule. Visit globule to see all supported options.
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on June 22, 2014.
FAQs
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.
The npm package normalize-config receives a total of 60 weekly downloads. As such, normalize-config popularity was classified as not popular.
We found that normalize-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.