Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_.each(allAggregateKeys, aggregateKey => {
const status = statusByAggregateKey[aggregateKey];
if (status && _isExpired(status, allAggregates[aggregateKey].published)) {
expiredAggregates[aggregateKey] = true;
} else if (status) {
activeAggregates[aggregateKey] = true;
}
});
// Note: We need to delete aggregated entities and save them here within the collection chain to avoid nuking undelivered
// entities. If we saved aggregated entities during the routing phase and only deleted them here, it would save us a write
// as we wouldn't have to write them to the queue, but it exposes a race condition where entities that are saved between
// getAggregateStatus (above) and deleteAggregateData (below) will be deleted before delivery.
// Step #5: Delete all the expired aggregates before aggregating new stuff
ActivityDAO.deleteAggregateData(_.keys(expiredAggregates), err => {
if (err) {
return callback(err);
}
// Step #6: Retrieve all entities that are aggregated within the active aggregates so they can be collected into redelivered activities
ActivityDAO.getAggregatedEntities(_.keys(activeAggregates), (err, fetchedEntities) => {
if (err) {
return callback(err);
}
/*!
* Step #7:
*
* Here we choose which aggregates need to be wrapped up into an activity and delivered to the activity stream. This is
* rather difficult to get right. These are the rules implemented below:
*
});
if (colourSchemeSelect.children().length >= 1) {
colourSchemeSelect.val(isStoredUsable ? newThemeStoredScheme : colourSchemeSelect.first().val());
} else {
// This should never happen. In case it does, lets use the default one
colourSchemeSelect.append(
$('<option value="' + colour.schemes[0].name + '">' + colour.schemes[0].desc + "</option>"));
colourSchemeSelect.val(colourSchemeSelect.first().val());
}
colourSchemeSelect.trigger('change');
}
var langs = options.languages;
var defaultLanguageSelector = root.find('.defaultLanguage');
var defLang = settings.defaultLanguage || _.keys(langs)[0] || 'c++';
add(defaultLanguageSelector, 'defaultLanguage', defLang, Select,
_.map(langs, function (lang) {
return {label: lang.id, desc: lang.name};
})
);
if (subLangId) {
defaultLanguageSelector
.prop('disabled', true)
.prop('title', 'Default language inherited from subdomain')
.css('cursor', 'not-allowed');
}
add(root.find('.newEditorLastLang'), 'newEditorLastLang', true, Checkbox);
var formats = ["Google", "LLVM", "Mozilla", "Chromium", "WebKit"];
add(root.find('.formatBase'), 'formatBase', formats[0], Select,
}
} else {
if((_.intersection(fieldsNames, FK.fields) || []).length < FK.fields.length) {
valid = false;
errors = errors.concat('A JSON Table Schema foreignKey.fields value must correspond with field names.');
};
}
// Ensure that `foreignKey.reference` is present and is a hash
if(!utilities.isHash(FK.reference)) {
valid = false;
errors = errors.concat('A JSON Table Schema foreignKey.reference must be a hash.');
}
// Ensure that `foreignKey.reference` has a `resource` key
if(!_.contains(_.keys(FK.reference), 'resource')) {
valid = false;
errors = errors.concat('A JSON Table Schema foreignKey.reference must have a resource key.');
}
// Ensure that `foreignKey.reference` has a `fields` key
if(!_.contains(_.keys(FK.reference), 'fields')) {
valid = false;
errors = errors.concat('A JSON Table Schema foreignKey.reference must have a fields key.');
}
// Ensure that `foreignKey.reference.fields` matches outer `fields`
if(_.isString(FK.fields)) {
if(!_.isString(FK.reference.fields)) {
valid = false;
errors = errors.concat('A JSON Table Schema foreignKey.reference.fields must match field names.');
}
gnuplot = exec('gnuplot | ps2pdf - ' + options.filename,
(options.exec ? options.exec : {}),
options.finish || post_gnuplot_processing);
} else { /* Default for everything else */
gnuplot = exec('gnuplot > ' + options.filename,
(options.exec ? options.exec : {}),
options.finish || post_gnuplot_processing);
}
/* Sets up gnuplot based on the properties we've been given in the
* options object */
setup_gnuplot(gnuplot, options);
/* Get an array containing all the series */
var series = _.keys(options.data);
/* Reject series that are functions or come from higher up the protoype chain */
var i;
for (i = 0; i < series.length; i += 1) {
if (!options.data.hasOwnProperty(series[i]) ||
typeof options.data[series[i]] === 'function') {
delete series[i]; /* undefine this element */
}
}
/* Filter out any undefined elements */
series = _.filter(series, function() { return true; });
/* Print the command to actually do the plot */
gnuplot.stdin.write('plot');
for (i = 1; i <= series.length; i += 1) { /* For each series */
/* Instruct gnuplot to plot this series */
gnuplot.stdin.write('\'-\' using 1:2 title\'' + series[i - 1] +
function createFilterFromObject(filterObj) {
var keys = _.keys(filterObj);
var filterFunctions = _.map(keys, function(key) {
var val = filterObj[key];
if (_.isFunction(val)) {
return convertKeyFunctionToFunction(key, val);
}
return convertKeyValueToFunction(key, val);
});
// Iterate through each of the generated filter functions. If any
// are false, kill the computation and return false. The function
// is only true if all of the subfunctions are true.
var filterFunction = function(model) {
for (var i = 0; i < filterFunctions.length; i++) {
if (!filterFunctions[i](model)) {
return false;
self.roundtrip({ path: path, method: 'GET' }, function (err, response, body) {
var ciphertext, inner, outer, result
if (err) return callback(err)
outer = body.payload
if (!options.sessionId) outer = outer && outer.state
inner = outer && outer.payload
if (!inner) return callback(null, {})
result = { object1: underscore.omit(inner, 'encryptedData', 'iv') }
ciphertext = underscore.pick(inner, 'encryptedData', 'iv')
if (underscore.keys(ciphertext).length === 0) return callback(null, result)
webcrypto.subtle.decrypt({ name: 'AES-GCM',
iv: hex2ab(ciphertext.iv)
}, self.runtime.masterKey, hex2ab(ciphertext.encryptedData)).then(
function (plaintext) {
try { result.object2 = ab2obj(plaintext) } catch (err) { result.err = err }
callback(null, result)
}
)
})
}
for(i = 0; i < mdls.length; i++) {
yield self.loadModule(mdls[i]);
}
var moduleConfigConfig = moduleConfig['moduleConfig'];
if(moduleConfigConfig) {
const keys = Object.keys(moduleConfigConfig);
for(i = 0; i < keys.length; i++) {
if(moduleConfigConfig[keys[i]]['config']) {
yield _setModuleConfig(keys[i], moduleConfigConfig[keys[i]]['config']);
}
}
}
var moduleNames = _.keys(modules);
i = moduleNames.length;
while(i--) {
var mn = moduleNames[i];
if(!moduleConfigConfig[mn]) {
yield self._stopModule(mn);
yield self._removeModule(mn);
moduleNames.splice(i, 1);
}
else if(!moduleConfigConfig[mn]['start']) {
yield self._stopModule(mn);
if(!moduleConfigConfig[mn]['initialise']) {
yield self._removeModule(mn);
moduleNames.splice(i, 1);
}
}
}
render: function() {
var sel = this.model.get('selection'),
type = this.model.get('type'),
vals = _.keys(sel);
if (vals.length == 0) {
this.clear();
return this;
}
var sql = util.negateClause(this.model.toSQLWhere());
this.$el.html(this.errtemplate({sql: sql}));
this.$(".clause").addClass("temporary");
this.$el.show()
return this;
},
exports.objectKeysLength = function (value) {
if (!value) {
return 0;
}
return _.keys(value).length;
};
var getExtraKeys = function (standardObj, testObj) {
var stdKeys = uscore.keys(standardObj);
var testKeys = uscore.keys(testObj);
return uscore.difference(testKeys, stdKeys);
};