function getColumns(tableName) { return db('information_schema.columns') .where({ table_name: tableName }) .select('column_name') .options({ rowMode: 'array' }) .then(fp.map(fp.first)) }
function addPrefixAliasToColumns(tableName, columns) { const fn = fp.map((column) => `${tableName}.${column} as ${tableName}_${column}`) if (columns) { return fn(columns) } return fn }
fp.mapValues(fp.map('message')), fp.groupBy('context.key') ])(err.details)
]) return fp.map((contribution) => Object.assign(omitUserAndRepositoryColumns(contribution), { user: getColumnsByTableNamePrefix(User.tableName, contribution), repository: getColumnsByTableNamePrefix(Repository.tableName, contribution)
const parseDependencies = (functionStr) => { const parsed = babylon.parse(functionStr, { sourceType: 'script' }); // get the first argument of the function, then get its desctructued properties const properties = f.flow( f.get('program.body.0.expression.params.0.properties'), f.map('key.name') )(parsed); return properties; }
fp.flow([ fp.filter((v, k) => isValidField(v)), fp.uniq, fp.map(replaceSelectAliases), fp.flatten, ])
/** * Load env step * @param nconf - nconf instance * @param options - plugin options */ const loadEnv = (nconf, options) => { if (_.has('disable.env', options)) return promiseIfNeeded(options); const envOpts = _.isArray(options.env) ? {whitelist: options.env} : options.env || {}; envOpts.parseValues = options.parse; envOpts.separator = options.separator; const transformer = getTransformer(options); if (options.normalize) { envOpts.whitelist = _.map(_[options.normalize], envOpts.whitelist); } if (transformer) envOpts.transform = transformer; nconf.env(envOpts); return promiseIfNeeded(options); }
const checkVoidModules = (createdModules, graphDetails) => { const voidModulesInjected = f.flow( f.pickBy(module => module == null), f.keys, f.tap(modules => { if (modules.length) { console.log(`the modules "${modules.join(', ')}" are void`); } }), f.map(moduleName => [moduleName, graphDetails.depends(moduleName)]), f.filter('1.length') )(createdModules); if (voidModulesInjected.length) { f.flow( f.forEach(([moduleName, dependents]) => { console.log(`the module "${moduleName}" has no return and can't\ be injected in the modules "${dependents.join(', ')}"`); }) )(voidModulesInjected); throw new Error('depending on void modules'); } }
_.map(spacePattern.test.bind(spacePattern)), _.every )(spaces)
return _.flow([ fp.filter(checkPath(key)), fp.map(_.tail), fp.filter(a => a && a.length) ])(paths); } else if (_.isArray(value)) { result[key] = _.flow([ fp.map((a) => recursionFn(a, subpaths)), fp.filter(_.negate(_.isEmpty)), ])(value); }; paths = _.map(paths, (v) => v.split('.')); return recursionFn(obj, paths);
fp.mapValues(fp.map(1)), fp.groupBy(_.head), fp.filter(([k, v]) => Post.isEditablePostField(k)), fp.flatten, fp.map(_.toPairs), fp.map(flattenObject), fp.filter(Boolean), fp.map('update') )(i) })), fp.map(fp.pick(['target.boardUri', 'target.postId', 'update'])), )(validTargets); .map((i) => ({ ...i, update: _.pickBy(i.update, (v) => v.length > 1) .map((i) => ({ ...i, update: _.mapValues(
const subpaths = _.flow([ fp.filter(subpath => subpath.startsWith(topKey + '.')), fp.map(_.flow([ fp.split('.'), fp.tail, return acc; const mappedDocs = _.map(subdocs, (subdoc) => { return pickRecursive(subdoc.toObject({ minimize: false, docs: _.map(documents, processResponse), count: documentCount, }; docs: _.map(documents, processResponse), };