import always from '@tinkoff/utils/function/always' ; import { wrapMapToPropsConstant , wrapMapToPropsFunc , wrapMapToPropsObject } from './wrapMapToProps' ; import type { MapContextToProps } from './types' ; export function whenMapContextToPropsIsFunction ( mapContextToProps ) { return typeof mapContextToProps === 'function' ? wrapMapToPropsFunc ( mapContextToProps , 'mapContextToProps' ) : undefined ; } export function whenMapContextToPropsIsMissing ( mapContextToProps ) { return ! mapContextToProps ? wrapMapToPropsConstant ( always ( { } ) ) : undefined ; } export function whenMapContextToPropsIsObject ( mapContextToProps ) { return typeof mapContextToProps === 'object' && mapContextToProps !== null ? wrapMapToPropsObject ( mapContextToProps ) : undefined ; } export const mapContextToPropsFactories = [ whenMapContextToPropsIsObject , whenMapContextToPropsIsFunction , whenMapContextToPropsIsMissing , ] ;