/** * Merge `mixins` property in schema * * @static * @param {Object} src Source schema property * @param {Object} target Target schema property * * @returns {Object} Merged schema */ static mergeSchemaUniqArray(src, target) { return _.uniqWith(_.compact(flatten([src, target])), _.isEqual); }
_.forEach(requestedProfiles, (requestedProfile) => { if (opts.argv.profiles[requestedProfile]) { // keep only the unique profiles and eliminate duplicates from test run profiles = _.uniqWith( _.concat(profiles, opts.argv.profiles[requestedProfile]), _.isEqual ); } else { notFoundProfiles.push(requestedProfile); } });
function flattenStats(edges) { const serviceEdges = edges.map(edge => ({ source: { name: getEdgeName(edge.source), tags: edge.source.tags }, destination: { name: getEdgeName(edge.destination), tags: edge.destination.tags }, stats: { count: (edge.stats.count / WINDOW_SIZE_IN_SECS), errorCount: (edge.stats.errorCount / WINDOW_SIZE_IN_SECS) } })); return _.uniqWith(serviceEdges, _.isEqual); }
ComponentFunctions.getByUuid(component.uuid, function(err, component) { Kit.find({}) .where('uuid').in(kitUuids) .exec(function(err, kits) { if (err) { next(err); } else if (kits.length > 0) { async.map(kits, function(kit, callback) { kit.components.push(component._id); kit.components = _.uniqWith(kit.components, _.isEqual); kit.save(callback); }, next); } else { next(); } }); });
ComponentFunctions.getByUuid(componentData.uuid, function(err, component) { if (component) { Robot.find({}) .where('uuid').in(robotUuids) .select('-__v') .exec(function(err, robots) { if (err) { next(err); } else if (robots.length > 0) { async.map(robots, function(robot, callback) { robot.includedComponents.push(component._id); robot.includedComponents = _.uniqWith(robot.includedComponents, _.isEqual); robot.save(callback); }, next); } else { next(); } }); } else { next(); } });
doc.attachments = _.uniqWith( resources.concat(doc.attachments), _.isEqual