export function composeAnalytics( ...analytics ) { return { type: ANALYTICS_MULTI_TRACK, meta: { analytics: flatMap( analytics, property( 'meta.analytics' ) ), }, }; }
export function getCommentById( { state, commentId, siteId } ) { const errorKey = getErrorKey( siteId, commentId ); if ( state.comments.errors[ errorKey ] ) { return state.comments.errors[ errorKey ]; } const commentsForSite = flatMap( filter( state.comments.items, ( comment, key ) => { return deconstructStateKey( key ).siteId === siteId; } ) ); return find( commentsForSite, ( comment ) => commentId === comment.ID ); }
/* * Parse docker-compose options */ const parseOptions = (opts = {}) => { const flags = _.map(composeFlags, (value, key) => _.get(opts, key, false) ? value : ''); const environment = _.flatMap(opts.environment, (value, key) => ['--env', `${key}=${value}`]); const user = (_.has(opts, 'user')) ? ['--user', opts.user] : []; const workdir = (_.has(opts, 'workdir')) ? ['--workdir', opts.workdir] : []; const entrypoint = _.map(opts.entrypoint, entrypoint => ['--entrypoint', entrypoint]); return _.compact(_.flatten([flags, environment, user, workdir, entrypoint])); }
// Add the blocks config to the views object for usage in the admin UI // (ie; { Cell: , Field: , Filters: , blocks: ...}) extendAdminViews(views) { return { ...views, blocks: unique(flatMap(this.blocks, block => block.getAdminViews())), }; }
// Helper to get init config const getInitConfig = dirs => _(dirs) .filter(dir => fs.existsSync(dir)) .flatMap(dir => glob.sync(path.join(dir, '*', 'init.js'))) .map(file => require(file)) .value()
_lodash.default.flatMap(arr, value => { return (atom => { if (Array.isArray(atom)) { return value.map(transformer); } else { return transformer(atom); } })(value); })
_(files) .flatMap(file => traverseUp(path.resolve(startFrom, file))) .sortBy().reverse() .filter(file => fs.existsSync(file) && path.isAbsolute(file)) .thru(files => _.isEmpty(files) ? [] : [_.first(files)]) .flatMap(dirFile => _.map(files, file => path.join(path.dirname(dirFile), file))) .filter(file => fs.existsSync(file)) .value()
createConstraint( _.flatMap(fieldValue.$nin, (elt) => elt), true );
_(config) .flatMap(service => service) .map(url => exports.parseUrl(url)) .map(data => `${data.host}${data.pathname}:${data.port}`) .countBy() .value()
_.flatMap(arr, value => { return (atom => { if (Array.isArray(atom)) { return value.map(transformer); } else { return transformer(atom); } })(value); })
createConstraint( _.flatMap(fieldValue.$in, (elt) => elt), false );
_(urls) .map(url => exports.parseUrl(url)) .flatMap(url => getInfoUrls(url, ports, hasCerts)) .value()
// Add the blocks config to the views object for usage in the admin UI // (ie; { Cell: , Field: , Filters: , blocks: ...}) extendAdminViews(views) { return { ...views, blocks: unique(flatMap(this.blocks, block => block.getAdminViews())), }; }