exec('git branch --no-color -a', options, (error, stdout, stderr) => { if (stderr || error) return reject(stderr || error); const getCurrentBranch = R.compose( R.trim, R.replace('*', ''), R.find(line => line.startsWith('*')), R.split('\n') ); const processBranches = R.compose( R.filter(br => stdout.match(new RegExp(`remotes\/.*\/${br}`))), R.uniq ); const currentBranch = getCurrentBranch(stdout); const branches = processBranches([currentBranch, defaultBranch]); return excludeCurrentRevision ? resolve(branches) : getCurrentRevision(exec, projectPath) .then((currentRevision) => { return resolve(branches.concat(currentRevision)); }); });
export default curry((defaultValue: number, v?: null | string | number) => compose< string | number | null | undefined, number | null | undefined, number>( defaultTo(defaultValue), when(compose(not, isEmpty), (value: string) => +value), )(v));
getIdOrNullFor = type => compose( ifElse(isNil, always(null), compose( ifElse( contains(type), compose<string, string[], string, number, Record<string, number>>( objOf(`${type}_id`), Number, last, split('-'), ), always(null), ), )), );
const getBasePathFilter = (pathParts: string[]): ((data: object | object[]) => object) => { return R.compose( R.head, R.filter( R.compose( R.equals(`/${R.propOr('', 0, pathParts)}`), getRoute ) ), wrap ); };
export const associationDecorator = ({ modelName, fields }: { modelName: string; fields }) => { const TAG = '[associationDecorator]'; logger.log(TAG, { fields }); // prettier-ignore const associationFields = R.filter(R.compose(R.not, R.isNil, R.prop('associations')))(fields); logger.log(TAG, { associationFields }, R.not(R.isEmpty(associationFields))); if (R.not(R.isEmpty(associationFields))) { const wrapForeignOpt = R.map(opt => ({ ...opt, association: AppContext.adapters.models.getAssociationConfigs(opt.modelName), })); const withAssociations = R.mapObjIndexed(field => ({ ...field, foreignOpts: wrapForeignOpt(field.foreignOpts), }))(associationFields); logger.debug(TAG, { withAssociations, wrapForeignOpt }); const wrappedFields = R.mergeDeepRight(fields, withAssociations); logger.debug(TAG, { wrappedFields }); return { modelName, fields: wrappedFields }; } return { modelName, fields }; };
export const setData = <T>( data: T, /** * If a schema is provided, execute its validate method. If the validation fails, the * errors will be set at L.validationError's path. */ schema?: ObjectSchema<T>, /** * postValidationTransform will be applied to the data just before it's set on the configuration * object, after the validation has happened. Use with caution: It was created as a trap door for * merging IPv4 addresses and ports in the NodeBalancer creation flow. */ postValidationTransform?: (v: any) => any ) => { if (!schema) { return set(L.data, data); } const updatedData = typeof postValidationTransform === 'function' ? postValidationTransform(data) : data; try { schema.validateSync(data, { abortEarly: false }); return set(L.data, updatedData); } catch (error) { return compose( set(L.data, updatedData), set(L.validationErrors, convertYupToLinodeErrors(error)) ); } };
const extractItemsBy = primaryKey => R.compose( R.uniqBy(R.prop(primaryKey)), R.flatten, R.map(R.path(['data', 'items'])), R.flatten, );
export function formatRemotes(remotes: string[]) : string[] { const process = R.compose( R.uniq, R.map(R.replace(/\/$/, '')), R.reject(R.isEmpty), R.map(R.replace(/\n/, '')), R.map(R.trim), R.map(rem => rem.replace(/\/\/(.+)@github/, '//github')), R.map(rem => rem.match(/github\.com/) ? rem.replace(/\.git(\b|$)/, '') : rem), R.reject(R.isNil), R.map(rem => { if (rem.match(/^https?:/)) { return rem.replace(/\.git(\b|$)/, ''); } else if (rem.match(/@/)) { return 'https://' + rem .replace(/^.+@/, '') .replace(/\.git(\b|$)/, '') .replace(/:/g, '/'); } else if (rem.match(/^ftps?:/)) { return rem.replace(/^ftp/, 'http'); } else if (rem.match(/^ssh:/)) { return rem.replace(/^ssh/, 'https'); } else if (rem.match(/^git:/)) { return rem.replace(/^git/, 'https'); } }) ); return process(remotes); }
function isFeedItem(x:OutlineFeedParent|OutlineFolderParent):x is OutlineFeedParent { return compose( lt(0), length, path(['$', 'xmlUrl']) )(x) }
process.nextTick(function () { if (!state) { return; } compose( modulesCheckMessage, compiledMessage )(stats); });