How to use the ramda-extension.isObject 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 / redux-tools / packages / injectors-react / src / makeHook.js View on Github external
const makeHook = storeInterface => {
	invariant(isObject(storeInterface), 'The store interface is undefined.');

	const { getEntries, ejectionKey, injectionKey, type } = storeInterface;

	const pascalCaseType = toPascalCase(type);
	const hookName = `use${pascalCaseType}`;

	const useInjectables = (injectables, options = {}) => {
		const injectableKeys = keys(injectables);

		const locationMessage =
			`@redux-tools: This warning happened while injecting the following ${type}: ` +
			`${injectableKeys}.`;

		const warn = (...args) => console.warn(locationMessage, ...args);

		// NOTE: `options.global` and `options.persist` are deprecated.
github lundegaard / redux-tools / packages / injectors / src / enhanceStore.js View on Github external
const enhanceStore = (prevStore, storeInterface, { onEjected = noop, onInjected = noop } = {}) => {
	invariant(
		isObject(prevStore),
		'You must pass a Redux store as the first argument to `enhanceStore()`'
	);

	invariant(
		isObject(storeInterface),
		'You must pass a store interface as the second argument to `enhanceStore()`'
	);

	const { injectionKey, ejectionKey, getEntries, setEntries, type } = storeInterface;
	const { dispatch = noop } = prevStore;
	const actionType = toScreamingSnakeCase(type);

	const inject = (injectables, props = {}) => {
		const entries = createEntries(injectables, props);

		forEach(
			entry =>
				invariant(
					// NOTE: `isFunction` from ramda-extension returns `false` for `jest.fn()`.
					typeof entry.value === 'function',
					`Injecting ${type}, but the value of ${JSON.stringify(entry)} is not a function.`
github lundegaard / validarium / packages / core / src / createMainValidate.js View on Github external
		[(a, b) => isObject(a) && isObject(b), mergeDeepLeft],
		[T, headArg],
github lundegaard / redux-tools / packages / extensible-store-react / src / decorators / namespacedConnect.js View on Github external
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 / injectors / src / enhanceStore.js View on Github external
const enhanceStore = (prevStore, storeInterface, { onEjected = noop, onInjected = noop } = {}) => {
	invariant(
		isObject(prevStore),
		'You must pass a Redux store as the first argument to `enhanceStore()`'
	);

	invariant(
		isObject(storeInterface),
		'You must pass a store interface as the second argument to `enhanceStore()`'
	);

	const { injectionKey, ejectionKey, getEntries, setEntries, type } = storeInterface;
	const { dispatch = noop } = prevStore;
	const actionType = toScreamingSnakeCase(type);

	const inject = (injectables, props = {}) => {
		const entries = createEntries(injectables, props);

		forEach(
github lundegaard / redux-tools / packages / injectors-react / src / makeDecorator.js View on Github external
const makeDecorator = config => {
	invariant(isObject(config), 'The injector config is undefined.');

	const useInjectables = makeHook(config);
	const { type } = config;
	const decoratorName = type ? `With${toPascalCase(type)}` : 'Injector';

	return (injectables, options = {}) => NextComponent => {
		const Injector = ({ feature: propFeature, namespace: propNamespace, ...otherProps }) => {
			const feature = options.feature || propFeature || DEFAULT_FEATURE;
			const contextNamespace = useNamespace(feature);
			const namespace = options.namespace || propNamespace || contextNamespace;
			const isInitialized = useInjectables(injectables, { ...options, feature, namespace });

			if (isInitialized) {
				return (