How to use the ramda-extension.noop function in ramda-extension

To help you get started, we’ve selected a few ramda-extension examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lundegaard / react-union / packages / react-union-scripts / scripts / lib / utils.js View on Github external
/**
 * Converts the passed config to normalized shape.
 *
 * @example
 *
 * 		normalizeConfig(["app", { name: "app2" }]) // [{ name: "app" }, { name: "app2" }]
 *
 * 		normalizeConfig({ templateFilename: 'index.ejs', apps: ["app"]})
 * 		// [{ name: "app", templateFilename: 'index.ejs', }]
 *
 * @see tests
 */
const normalizeConfig = R.cond([
	[R_.isArray, fromArrayConfig_],
	[R_.isObject, fromObjectConfig_],
	[R.T, R_.noop],
]);

const getAppPattern_ = R.path(['workspaces', 'appPattern']);

const setAppsIfMissing_ = config => {
	const uniRepoDirs = () => utilsFs.readDirs(DEFAULT_UNI_REPO_APP_DIR);
	const appsPattern = getAppPattern_(config) || getAppPattern_(DEFAULT_UNION_CONFIG);
	const appDirs = isMonoRepo ? utilsFs.readAllAppsFromWorkspaces(appsPattern) : uniRepoDirs();
	return R.cond([
		[nilOrEmpty_, R.always(appDirs)],
		[R_.isArray, R.identity],
		[c => !c.apps, c => R.mergeDeepRight(c, { apps: appDirs })],
		[R.T, R.identity],
	])(config);
};
github lundegaard / react-union / packages / react-union-scripts / scripts / lib / utils.js View on Github external
const getUnionConfig = () =>
	R.pipe(
		R.ifElse(fs.existsSync, x => require(x), R_.noop),
		whenIsFunction_(R.applyTo(cli)),
		setAppsIfMissing_,
		normalizeConfig,
		R.tap(validateConfig_),
		extendConfigs
	)(UNION_CONFIG_PATH);