Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function env(prefix) {
var obj = {};
var prefixLength = prefix.length;
prefix = prefix.toLowerCase();
object.forOwn(process.env, function(value, key) {
key = key.toLowerCase();
if (string.startsWith(key, prefix)) {
var parsedKey = key
.substr(prefixLength)
.replace(/__/g, '.') // __ is used for nesting
.replace(/_/g, '-'); // _ is used as a - separator
//use a convention patern to accept array from process.env
//e.g. export bower_registry__search='["http://abc.com","http://def.com"]'
var match = /\[([^\]]*)\]/g.exec(value);
var targetValue;
if (!match || match.length === 0) {
targetValue = value;
} else {
targetValue = match[1].split(',').map(function(m) {
function env(prefix) {
var obj = {};
var prefixLength = prefix.length;
prefix = prefix.toLowerCase();
object.forOwn(process.env, function (value, key) {
key = key.toLowerCase();
if (string.startsWith(key, prefix)) {
var parsedKey = key
.substr(prefixLength)
.replace(/__/g, '.') // __ is used for nesting
.replace(/_/g, '-'); // _ is used as a - separator
//use a convention patern to accept array from process.env
//e.g. export bower_registry__search='["http://abc.com","http://def.com"]'
var match = /\[([^\]]*)\]/g.exec(value);
var targetValue;
if (!match || match.length === 0) {
targetValue = value;
} else {
targetValue = match[1].split(',')
function camelCase(config) {
var camelCased = {};
// Camel case
object.forOwn(config, function (value, key) {
// Ignore null values
if (value == null) {
return;
}
key = string.camelCase(key.replace(/_/g, '-'));
camelCased[key] = lang.isPlainObject(value) ? camelCase(value) : value;
});
return camelCased;
}
function camelCase(config) {
var camelCased = {};
// Camel case
object.forOwn(config, function(value, key) {
// Ignore null values
if (value == null) {
return;
}
key = string.camelCase(key.replace(/_/g, '-'));
camelCased[key] = lang.isPlainObject(value) ? camelCase(value) : value;
});
return camelCased;
}
function askConfirmation(logger, config){
var cleanConfig = _o.merge({}, config);
// Cleanup empty props (null values, empty strings, objects and arrays)
_o.forOwn(cleanConfig, function (value, key) {
if (key === 'svmType'){
cleanConfig.svmType = svmTypesString[value];
}
else if (key === 'kernelType'){
cleanConfig.kernelType = kernelTypesString[value];
}
else if (key === 'cwd' ||
key === 'argv' ||
key === 'interactive' ||
key === 'color'){
delete cleanConfig[key];
}
else if (value === null ||
_l.isEmpty(value) &&
!_l.isNumber(value) &&
!_l.isBoolean(value)) {
function camelCase(config) {
var camelCased = {};
// Camel case
_o.forOwn(config, function (value, key) {
// Ignore null values
if (value == null) {
return;
}
key = _s.camelCase(key.replace(/_/g, '-'));
camelCased[key] = _l.isPlainObject(value) ? camelCase(value) : value;
});
return camelCased;
}
TempDir.prototype.create = function(files, defaults) {
var that = this;
defaults = defaults || this.defaults || {};
files = object.merge(files || {}, defaults);
this.meta = function(tag) {
if (tag) {
return files[tag]['bower.json'];
} else {
return files['bower.json'];
}
};
if (files) {
object.forOwn(files, function(contents, filepath) {
if (typeof contents === 'object') {
contents = JSON.stringify(contents, null, ' ') + '\n';
}
var fullPath = path.join(that.path, filepath);
mkdirp.sync(path.dirname(fullPath));
fs.writeFileSync(fullPath, contents);
});
}
return this;
};
SVM.prototype._restore = function (model) {
var self = this;
this._baseSvm = BaseSVM.restore(model);
_o.forOwn(model.params, function(val, key){
self._config[key] = val;
});
};