How to use the ramda-extension.isFunction 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 / src / components / Widget / Widget.js View on Github external
getInitialProps = component => {
		const { config } = this.props;

		if (isFunction(component.getInitialProps)) {
			component.getInitialProps(config).then(initialProps => this.setState({ initialProps }));
		}
	};
github lundegaard / redux-tools / packages / extensible-store-react / src / decorators / namespacedConnect.js View on Github external
export const makeMapDispatchToProps = mapDispatchToProps => (
	dispatch,
	ownProps
) => {
	if (!mapDispatchToProps) {
		return {};
	}

	const wrappedDispatch = o(
		dispatch,
		mergeDeepRight({ meta: { namespace: ownProps.namespace } })
	);

	if (isFunction(mapDispatchToProps)) {
		return mapDispatchToProps(wrappedDispatch, ownProps);
	}

	if (isObject(mapDispatchToProps)) {
		const wrapActionCreator = actionCreator =>
			compose(
				wrappedDispatch,
				actionCreator
			);

		return map(wrapActionCreator, mapDispatchToProps);
	}

	throw new TypeError('mapDispatchToProps is not an object or a function');
};
github lundegaard / redux-tools / packages / namespaces / src / attachNamespace.js View on Github external
const mergeNamespace = curry((isForced, namespace, action) => {
	if (!namespace) {
		return action;
	}

	if (isFunction(action)) {
		const nextAction = (...args) => action(...args);

		if (isForced) {
			nextAction.meta = { namespace };
		} else {
			nextAction.meta = { namespace: getNamespaceByAction(action) || namespace };
		}

		return nextAction;
	}

	if (isForced) {
		return mergeDeepLeft({ meta: { namespace } }, action);
	}

	return mergeDeepRight({ meta: { namespace } }, action);
github lundegaard / redux-tools / packages / reducers / src / makeEnhancer.js View on Github external
const handler = ({ props, reducers }) => {
		invariant(
			props.namespace || !isFunction(reducers),
			'You can only inject reducers as functions if you specify a namespace.'
		);

		nextStore.replaceReducer(
			composeReducers(reducer, combineReducerEntries(storeInterface.getEntries(nextStore)))
		);
	};
github lundegaard / react-union / packages / react-union / src / components / Widget / Widget.js View on Github external
componentDidMount() {
		const { initialProps } = this.state;

		if (!initialProps) {
			const { config } = this.props;
			const { component } = config;

			if (isFunction(component.preload)) {
				return component.preload().then(this.getInitialProps);
			}

			this.getInitialProps(component);
		}
	}
github lundegaard / redux-tools / packages / thunk / src / index.js View on Github external
const makeThunkMiddleware = dependencies => ({ dispatch, getState }) => next => action => {
	if (isFunction(action)) {
		const namespace = getNamespaceByAction(action);

		return action({
			dispatch: o(dispatch, defaultNamespace(namespace)),
			getState,
			getNamespacedState: feature => getStateByNamespace(feature, namespace, getState()),
			namespace,
			...dependencies,
		});
	}

	return next(action);
};
github lundegaard / react-union / packages / react-union-scripts / scripts / startDevServer.js View on Github external
return R.map(config => {
		const proxyConfig = R_.isFunction(config) ? config() : config;
		return proxyMiddleware(proxyConfig.context, proxyConfig);
	}, normalizedConfig);
};
github lundegaard / react-union / packages / react-union-scripts / scripts / lib / middleware.js View on Github external
return map(config => {
		const proxyConfig = isFunction(config) ? config() : config;
		return httpProxyMiddleware(proxyConfig.context, proxyConfig);
	}, normalizedConfig);
};