Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should parse the specified keys to CSV', function (done) {
// Create a copy so we don't modify the actual options object
var opts = _.extend(JSON.parse(JSON.stringify(options)), {KEYS: ['info.name', 'year']});
converter.json2csv(json_arrayValue, function (err, csv) {
csv.should.equal(csv_arrayValue_specificKeys);
csv.split(options.EOL).length.should.equal(5);
done();
}, opts);
});
doFullBackup: function() {
chatHandler.announceRoom('mods', "Backing up server...", "blue");
var deploySh = spawn('sh', [ 'serverbackup.sh' ], {
//cwd: process.env.HOME + '/myProject',
cwd: '/root',
env:_.extend(process.env, {
PATH: process.env.PATH + ':/usr/local/bin'
})
});
deploySh.stderr.on('data', function (data) {
chatHandler.announceRoom('mods', data, "red");
//console.log('stderr: ' + data);
});
// handle error so server doesn't crash...
deploySh.on('error', function(err) {
log('Error doing full backup!', err);
});
deploySh.on('exit', function (code) {
chatHandler.announceRoom('mods', "Backup complete!", "blue");
// Check arguments
if (arguments.length != 4) {
var error = new Error('Please call svg-sprite.createSprite() with exactly 4 arguments');
error.errno = 1391852448;
return error;
}
// Keep the intermediate files
options = _.extend({}, defaultOptions, options || {});
options.verbose = Math.max(0, Math.min(3, parseInt(options.verbose, 10) || 0));
// Temporarily alter the configuration options to keep intermediate files and suppress all output rendering
options._keep = options.keep;
options.keep = 1;
options._render = _.extend({css: true}, options.render);
options.render = {css: false};
// Create the SVG sprite
var sprite = SVGSprite.createSprite(inputDir, outputDir, options, function(error, results) {
// Restore configuration options
results.options = restoreOptions(results.options);
// If an error occured while creating the SVG sprite: Abort
if (error) {
callback(error, results);
// Else: Create icon kit
} else {
new Iconizr(results).createIconKit(callback);
}
if (!options) options = {};
if (options.configPath) {
if (fs.existsSync(options.configPath)) {
config = require(options.configPath);
} else {
// self.log isn't setup until after config is loaded
console.warn('');
console.warn('The config file you passed does not exist: %s'.yellow, options.configPath);
console.warn('');
}
} else if (fs.existsSync(defaults.configPath)) {
config = require(path.resolve(defaults.configPath));
}
return _.extend(defaults, config, options);
}
Client.setDefaults = function(opts) {
_.extend(DEFAULT_OPTIONS, opts);
};
_.each(config.overrides, function (options, pattern) {
if (minimatch(path.normalize(file), pattern, { nocase: true, matchBase: true })) {
if (options.globals) {
globals = _.extend(globals || {}, options.globals);
delete options.globals;
}
_.extend(config, options);
}
});
}
function getStats(master) {
return _.extend({},
{
master : {
host: os.hostname(),
os: os.type(),
state: master.state,
pid: master.pid,
started: master.stats.start.toUTCString(),
restarts: master.stats.restarts,
workers: master.children.length,
workersKilled: master.stats.workersKilled,
averageLoad: os.loadavg().map(
function(n) {
return n.toFixed(2);
}).join(' '),
coresUsed: master.children.length + ' of ' + os.cpus().length,
memoryUsageAtBoot: forMemoryNum(master.stats.freemem) + ' of ' +
var ccg = module.exports = function (host, port) {
events.EventEmitter.call(this);
this.options = _.extend({}, this.options);
if (typeof(host) == "string") {
this.options.host = host;
} else if (typeof(host) == "object") {
_.extend(this.options, host);
}
if (port) {
this.options.port = port;
}
this.index = count++;
};
Overlay.register('fullscreen', function (data, vis) {
var options = _.extend(data, {
doc: vis.$el.find('> div').get(0),
allowWheelOnFullscreen: false,
mapView: vis.mapView
});
if (data.template) {
options.template = Template.compile(
data.template,
data.templateType || 'mustache'
);
}
var fullscreen = new FullScreen(options);
return fullscreen.render();
});
function Barn(namespace, storage, opts){
var _this = this;
this._storage = NSStorage.createNamespace(namespace, storage);
this._keys = {};
this._idx = 0;
this._keySet;
this._opts = {
maxKeys: 1000
};
_.extend(this._opts, opts);
this._cmds = {
DEL: {
fn: function(key){
var count = 0;
_this._keys[key] && count++;
delete _this._keys[key];
return count;
},
mutating: true
},
GET: {
fn: function(key){
return _this._getValExpectingType(key, 'string');
},
mutating: false