All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sagas.widgetDependency.sortDependency.ts Maven / Gradle / Ivy

The newest version!
import forOwn from 'lodash/forOwn'
import isEmpty from 'lodash/isEmpty'

import { metaPropsType } from '../../plugins/utils'

import { Dependencies } from './WidgetTypes'

export const sortDependency = (dependency: Dependencies) => {
    const tmpFetch: metaPropsType = {}
    let newDependency: metaPropsType = {}

    forOwn(dependency, (v, k) => {
        if (k !== 'fetch') {
            newDependency[k] = v
        } else {
            tmpFetch[k] = v
        }
    })

    if (!isEmpty(tmpFetch)) {
        newDependency = {
            ...newDependency,
            ...tmpFetch,
        }
    }

    return newDependency
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy