/* * Helper to get dynamic service keys for stripping */ const getDynamicKeys = (answer, answers = {}) => _(answers) .map((value, key) => ({key, value})) .filter(data => data.value === answer) .map(data => data.key) .map(key => (_.size(key) === 1) ? `-${key}` : `--${key}`) .value()
Promise .all([ queryCollaborators({ repositoryOwner, repositoryName }), queryCommits({ repositoryOwner, repositoryName, since }) ]) .then(results => { const collaborators = _.keyBy(results[0], 'login') return _.chain(results[1]) .map('author.user') .reject(_.isEmpty) .groupBy('login') .map(group => _.defaults({ commits: _.size(group) }, _.head(group))) .filter(user => _.isEmpty(collaborators[user.login])) .value() }) .then(res => formatOutput(res)) .catch(err => console.log(err))
// Helper to bind exposed ports to the correct address const normalizeBind = (bind, address = '127.0.0.1') => { // If bind is not a string, return right away if (!_.isString(bind)) return bind; // Otherwise attempt to do stuff const pieces = _.toString(bind).split(':'); // If we have three pieces then honor the users choice if (_.size(pieces) === 3) return bind; // Unshift the address to the front and return else if (_.size(pieces) === 2) { pieces.unshift(address); return pieces.join(':'); }; // Otherwise we can just return the address prefixed to the bind return `${address}::${bind}`; }
// Assess our key situation so we can warn users who may have too many app.events.on('post-init', () => { // Get keys on host const sshDir = path.resolve(lando.config.home, '.ssh'); const keys = _(fs.readdirSync(sshDir)) .filter(file => !_.includes(['config', 'known_hosts'], file)) .filter(file => path.extname(file) !== '.pub') .value(); // Determine the key size const keySize = _.size(_.get(app, 'config.keys', keys)); app.log.verbose('analyzing user ssh keys... using %s of %s', keySize, _.size(keys)); app.log.debug('key config... ', _.get(app, 'config.keys', 'none')); app.log.silly('users keys', keys); // Add a warning if we have more keys than the warning level if (keySize > lando.config.maxKeyWarning) { app.addWarning(warnings.maxKeyWarning()); } });
if (_.size(networks) >= 32) {
if (_.size(parts) === 4) { parts[2] = `${parts[2]}${parts.pop()}`; version = parts.join('.');
const elementColor = (logName === 'lando') ? 'lando' : 'app'; fcw = _.max([fcw, _.size(element)]);
let counter = 0; const id = '24601'; const reportable = _.size(_.filter(endpoints, endpoint => endpoint.report)); const metrics = new Metrics({id, endpoints, data: {prisoner: 'valjean'}}); sinon.stub(axios, 'create').callsFake(({baseURL = 'localhost'} = {}) => ({ {url: 'https://nsa.gov/prism', report: true}, ]; const reportable = _.size(_.filter(endpoints, endpoint => endpoint.report)); const metrics = new Metrics({endpoints, log: {debug: sinon.spy(), verbose: sinon.spy()}}); sinon.stub(axios, 'create').callsFake(() => ({
function checkCount(value, {count, minCount, maxCount} = {}) { const size = _.size(value); return (!count || size === count) && (!minCount || size >= minCount) && (!maxCount || size <= maxCount); }
QUnit.test('listenTo and stopListening cleaning up references', function(assert) { assert.expect(2); var a = _.extend({}, Backbone.Events); var b = _.extend({}, Backbone.Events); a.listenTo(b, 'all', function(){ assert.ok(true); }); b.trigger('anything'); a.listenTo(b, 'other', function(){ assert.ok(false); }); a.stopListening(b, 'other'); a.stopListening(b, 'all'); assert.equal(_.size(a._listeningTo), 0); });
_.after(_.size(definition.attributes), () => { // Generate schema without virtual populate _.set(strapi.config.hook.settings.mongoose, 'collections.' + mongooseUtils.toCollectionName(definition.globalName) + '.schema', new instance.Schema(_.omitBy(definition.loadedModel, model => { return model.type === 'virtual'; }))); loadedAttributes(); })
QUnit.test('save with PATCH', function(assert) { doc.clear().set({id: 1, a: 1, b: 2, c: 3, d: 4}); doc.save(); assert.equal(this.syncArgs.method, 'update'); assert.equal(this.syncArgs.options.attrs, undefined); doc.save({b: 2, d: 4}, {patch: true}); assert.equal(this.syncArgs.method, 'patch'); assert.equal(_.size(this.syncArgs.options.attrs), 2); assert.equal(this.syncArgs.options.attrs.d, 4); assert.equal(this.syncArgs.options.attrs.a, undefined); assert.equal(this.ajaxSettings.data, '{"b":2,"d":4}'); });
test('Test execute query with results', (assert) => { let query = OGMQueryBuilder.create('test').where(new OGMNeoWhere('name', { $eq: 'name1' })); OGMNeoNode.find(query).then((nodes) => { assert.ok(_.size(nodes) >= 1); nodes.forEach((node)=> { assert.notEqual(node.id, null); assert.equal(node.name,'name1'); }); assert.end(); }); });
function* explainExtraInput(predicates, value, via) { if (_.size(value) > 1) { yield { path: [], reason: 'Extra input', pred: ['alt', ...describe(predicates)], val: _.tail(value), via, 'in': [1] }; } }
Promise .all([ queryCollaborators({ repositoryOwner, repositoryName }), queryCommits({ repositoryOwner, repositoryName, since }) ]) .then(results => { const collaborators = _.keyBy(results[0], 'login') return _.chain(results[1]) .map('author.user') .reject(_.isEmpty) .groupBy('login') .map(group => _.defaults({ commits: _.size(group) }, _.head(group))) .filter(user => _.isEmpty(collaborators[user.login])) .value() }) .then(res => formatOutput(res)) .catch(err => console.log(err))