_(config) .flatMap(service => service) .map(url => exports.parseUrl(url)) .map(data => `${data.host}${data.pathname}:${data.port}`) .countBy() .value()
get currentDependencies() { let allDependencies = self.filteredProjects.reduce((accum, project) => { let dependencies = project.packageJson && project.packageJson.dependencies ? Object.entries({ ...project.packageJson.dependencies }).map(([a]) => a) : []; accum = [...accum, ...dependencies]; return accum; }, []); const grouped = Object.entries(countBy(allDependencies)).map(([name, count]) => ({ name, count })); const unique = uniqBy(grouped, a => a.name); const sorted = orderBy(unique, ['count', 'name'], ['desc', 'asc']); return sorted; }
/* * Adds a duplicate error to each mailBox with a duplicate mailbox */ const validateNewUsersAreUnique = ( users: GSuiteNewUser[] ) => { const mailboxesByCount: { [ mailbox: string ]: number } = countBy( users.map( ( { mailBox: { value: mailBox } } ) => mailBox ) ); return users.map( ( { uuid, domain, mailBox, firstName, lastName } ) => ( { uuid, firstName, lastName, domain, mailBox: validateNewUserMailboxIsUnique( mailBox, mailboxesByCount ), } ) ); }
j = floor( randu()*vals.length ); arr[ 0 ] = vals[ j ]; o = _.countBy( arr, indicator ); if ( typeof o !== 'object' ) { b.fail( 'should return an object' );
let bySlug; if (awaiting_moderation.length) { bySlug = countBy(awaiting_moderation, 'slug'); next(); awaiting_moderation.length = 0;
R.countBy(R.prop('type')), R.toString, R.replace('{', ''),
let transactionsByType = R.countBy(R.prop('type'), newBlock.transactions); if (transactionsByType.fee && transactionsByType.fee > 1) { console.error(`Invalid fee transaction count: expected '1' got '${transactionsByType.fee}'`);
const count = _(result) .flatten() .countBy() .value();
it('should execute with object and catch an error', () => { const error = new Error('error'); Aigle.mixin({ countBy: _.countBy }, { override: true }); return Aigle.countBy({ a: 0, b: 1, c: 2 }, (n) => { return n % 2 ? Aigle.delay(DELAY, n) : Aigle.reject(error); }) .then(assert.fail) .catch((err) => assert.strictEqual(err, error)); });
async calc(query) { const total = await this.dao.countBy(query); const totalPages = Math.ceil(total / this.perPage) > 1 ? Math.ceil(total / this.perPage) : 1; return { page: this.page, perPage: this.perPage, total, totalPages, }; }
it('should execute with object', () => { Aigle.mixin({ countBy: _.countBy }, { override: true }); const object = { a: 1.1, b: 1.4, c: 2.2 }; return Aigle.delay(DELAY, object) .countBy((n) => Aigle.delay(DELAY, Math.floor(n))) .then((object) => assert.deepStrictEqual(object, { '1': 2, '2': 1 })); });
_.chain(aggData[0]) .map(function(item) { return item.Timestamp + ' ' + item.EventType; }) .countBy(_.identity) .value()
function createServicesSummary(trace) { const services = _.countBy(trace, span => span.serviceName); return _.keys(services).map(service => ({ name: service, spanCount: services[service] })); }
j = floor( randu()*vals.length ); arr[ 0 ] = vals[ j ]; o = _.countBy( arr, indicator ); if ( typeof o !== 'object' ) { b.fail( 'should return an object' );
async calc(query) { const total = await this.dao.countBy(query); const totalPages = Math.ceil(total / this.perPage) > 1 ? Math.ceil(total / this.perPage) : 1; return { page: this.page, perPage: this.perPage, total, totalPages, }; }