Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mout.object.forOwn(config, function (value, key) {
// Ignore null values
if (value == null) {
return;
}
key = mout.string.camelCase(key.replace(/_/g, '-'));
camelCased[key] = mout.lang.isPlainObject(value) ? camelCase(value) : value;
});
.spread(function (json, installed, links) {
var root;
var jsonCopy = mout.lang.deepClone(json);
root = {
name: json.name,
source: this._config.cwd,
target: json.version || '*',
pkgMeta: jsonCopy,
canonicalDir: this._config.cwd,
root: true
};
mout.object.mixIn(installed, links);
// Mix direct extraneous as dependencies
// (dependencies installed without --save/--save-dev)
jsonCopy.dependencies = jsonCopy.dependencies || {};
jsonCopy.devDependencies = jsonCopy.devDependencies || {};
// warning about removed parameter
if ( options.transformGutter !== undefined ) {
grunt.log.error( "Parameter `transformGutter` is no longer supported and defaults to `|`. See #71 for details." );
}
// normalize basePath
if ( options.basePath.substr( -1 , 1 ) !== "/" && options.basePath.length > 0 ) {
options.basePath = options.basePath + "/";
}
// normalize content
if ( mout.lang.isString( options.content ) ) {
options.content = grunt.file.readJSON( options.content );
} else if ( mout.lang.isFunction( options.content ) ) {
options.content = options.content();
} else {
options.content = options.content ? options.content : {};
}
if ( options.section ) {
if ( ! options.content[ options.section ] ) {
grunt.log.error( "content doesn't have section " + options.section );
}
options.content = options.content[ options.section ];
}
function getArrayValues( string, values ) {
string = string.split( " " ).join( "" );
if ( arrayRegex.test( string ) )
return string.match( arrayRegex )[ 1 ].split( "," );
else {
var array = processPlaceholder( string, values );
if ( ! mout.lang.isArray( array ) ) array = [];
return array;
}
}
PackageAdapter.parseAuthorProperty = function(authors){
authors= mout.lang.toArray(authors);
if(authors.length === 1)
return resolvePeopleFields(authors[0]);
return;
};
PackageAdapter.parseFormatProperty = function(moduleType){
var contains = mout.array.contains;
moduleType = mout.lang.toArray(moduleType);
if(contains(moduleType, 'node') || contains(moduleType, 'cjs'))
return 'cjs';
if(contains(moduleType, 'amd'))
return 'amd';
if(contains(moduleType, 'globals') || contains(moduleType, 'global'))
return 'global';
if(contains(moduleType, 'es6'))
return 'es6';
return 'global';
};
function validConfigValue(val) {
return (
mout.lang.isObject(val) ||
mout.lang.isArray(val) ||
mout.lang.isString(val) ||
mout.lang.isBoolean(val) ||
mout.lang.isNumber(val)
);
}
function resolveNested( data, parentKey ) {
var name, key;
for ( key in data ) {
if ( data.hasOwnProperty( key ) ) {
name = parentKey ? format( parentKey + "-" + key, options.cssFormat ) : format( key, options.cssFormat );
if ( mout.lang.isObject( data[ key ] ) ) {
resolveNested( data[ key ], name );
} else {
var value = getStyleSafeValue( data[ key ] );
content += pattern.replace( "{{key}}", options.namespace + name ).replace( "{{value}}", value );
}
}
}
}
mout.object.forOwn(json, function (value, key) {
if (value == null || mout.lang.isEmpty(value)) {
delete json[key];
}
});