diff --git a/.eslintrc.js b/.eslintrc.js index 6b12d72670..c1d11bd2be 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,7 +24,10 @@ module.exports = { 'import/no-named-default': 'error', 'import/no-anonymous-default-export': 'error', 'import/dynamic-import-chunkname': 'error', - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, + ], }, settings: { react: { diff --git a/pages/accountLists/[accountListId]/tasks.tsx b/pages/accountLists/[accountListId]/tasks.tsx index 2a4a7aa629..71bf4f3ad6 100644 --- a/pages/accountLists/[accountListId]/tasks.tsx +++ b/pages/accountLists/[accountListId]/tasks.tsx @@ -3,23 +3,21 @@ import Head from 'next/head'; import { GetServerSideProps } from 'next'; import { getSession } from 'next-auth/client'; import { useTranslation } from 'react-i18next'; -import { castArray, pick } from 'lodash/fp'; import { parse } from 'query-string'; import { useRouter } from 'next/router'; import { useApp } from '../../../src/components/App'; import TaskHome from '../../../src/components/Task/Home'; import { TaskFilter } from '../../../src/components/Task/List/List'; -import reduceObject from '../../../src/lib/reduceObject'; export const initialFilterFromPath = (path: string): TaskFilter => { - let initialFilter = {}; + let initialFilter: TaskFilter = {}; const queryString = path.split('?')[1]; if (queryString) { const filter = parse(queryString); - initialFilter = reduceObject( - (result: TaskFilter, value: string | string[], key: string) => { + initialFilter = Object.entries(filter).reduce( + (result: TaskFilter, [key, value]) => { switch (key) { case 'completed': result.completed = value === 'true'; @@ -36,28 +34,34 @@ export const initialFilterFromPath = (path: string): TaskFilter => { result.startAt.min = value.toString(); break; default: - result[key.replace('[]', '')] = castArray(value); + result[key.replace('[]', '')] = Array.isArray(value) + ? value + : [value]; } return result; }, {}, - filter, ); - initialFilter = pick( - [ - 'userIds', - 'tags', - 'contactIds', - 'activityType', - 'completed', - 'wildcardSearch', - 'startAt', - ], - initialFilter, - ); + const { + userIds, + tags, + contactIds, + activityType, + completed, + wildcardSearch, + startAt, + } = initialFilter; - return initialFilter; + return { + userIds, + tags, + contactIds, + activityType, + completed, + wildcardSearch, + startAt, + }; } }; diff --git a/src/components/App/Provider.tsx b/src/components/App/Provider.tsx index f3d6ff8915..1c4825dca2 100644 --- a/src/components/App/Provider.tsx +++ b/src/components/App/Provider.tsx @@ -6,7 +6,6 @@ import React, { Dispatch, } from 'react'; import { v4 as uuidv4 } from 'uuid'; -import { omit, remove, find } from 'lodash/fp'; import TaskDrawer, { TaskDrawerProps } from '../Task/Drawer/Drawer'; import theme from '../../theme'; import rootReducer, { Action, AppState } from './rootReducer'; @@ -39,12 +38,10 @@ const AppProvider = ({ initialState, children }: Props): ReactElement => { const id = uuidv4(); if ( !taskDrawerProps.taskId || - !find( - { - taskId: taskDrawerProps.taskId, - showCompleteForm: taskDrawerProps.showCompleteForm, - }, - taskDrawers, + !taskDrawers.find( + ({ taskId, showCompleteForm }) => + taskId === taskDrawerProps.taskId && + showCompleteForm === taskDrawerProps.showCompleteForm, ) ) { setTaskDrawers([ @@ -56,7 +53,9 @@ const AppProvider = ({ initialState, children }: Props): ReactElement => { taskDrawerProps.onClose && taskDrawerProps.onClose(); setTimeout( () => - setTaskDrawers((taskDrawers) => remove({ id }, taskDrawers)), + setTaskDrawers((taskDrawers) => + taskDrawers.filter(({ id: taskId }) => taskId !== id), + ), theme.transitions.duration.leavingScreen, ); }, @@ -74,9 +73,11 @@ const AppProvider = ({ initialState, children }: Props): ReactElement => { return ( {children} - {taskDrawers.map((props: TaskDrawerPropsWithId) => ( - - ))} + {taskDrawers.map((props: TaskDrawerPropsWithId) => { + const { id, ...taskDrawerProps } = props; + + return ; + })} ); }; diff --git a/src/components/Dashboard/ThisWeek/PartnerCare/PartnerCare.tsx b/src/components/Dashboard/ThisWeek/PartnerCare/PartnerCare.tsx index 3c5b1a0cef..14f6ff7bbf 100644 --- a/src/components/Dashboard/ThisWeek/PartnerCare/PartnerCare.tsx +++ b/src/components/Dashboard/ThisWeek/PartnerCare/PartnerCare.tsx @@ -21,7 +21,7 @@ import CakeIcon from '@material-ui/icons/Cake'; import FavoriteIcon from '@material-ui/icons/Favorite'; import { Skeleton } from '@material-ui/lab'; import { motion } from 'framer-motion'; -import { uniqBy } from 'lodash/fp'; +import uniqBy from 'lodash/fp/uniqBy'; import { useTranslation } from 'react-i18next'; import Link from 'next/link'; import { dayMonthFormat } from '../../../../lib/intlFormat'; diff --git a/src/components/Layouts/Primary/TopBar/NotificationMenu/Item/Item.tsx b/src/components/Layouts/Primary/TopBar/NotificationMenu/Item/Item.tsx index 8ead1060cc..5045b9a71d 100644 --- a/src/components/Layouts/Primary/TopBar/NotificationMenu/Item/Item.tsx +++ b/src/components/Layouts/Primary/TopBar/NotificationMenu/Item/Item.tsx @@ -13,7 +13,6 @@ import { import { Skeleton } from '@material-ui/lab'; import React, { ReactElement } from 'react'; import { useTranslation } from 'react-i18next'; -import { cloneDeep, isFunction } from 'lodash/fp'; import { isSameMonth } from 'date-fns'; import { AcknowledgeUserNotificationMutation } from '../../../../../../../types/AcknowledgeUserNotificationMutation'; import { @@ -102,14 +101,19 @@ const NotificationMenuItem = ({ after: null, }, }; - const data = cloneDeep(cache.readQuery(query)); + const dataFromCache = cache.readQuery(query); + const data = { + userNotifications: { + ...dataFromCache.userNotifications, + }, + }; data.userNotifications.unreadCount--; cache.writeQuery({ ...query, data }); optimisticResponse = false; }, }); } - if (isFunction(onClick)) onClick(); + if (typeof onClick === 'function') onClick(); }; let message; diff --git a/src/components/Layouts/Primary/TopBar/NotificationMenu/NotificationMenu.tsx b/src/components/Layouts/Primary/TopBar/NotificationMenu/NotificationMenu.tsx index 646c878639..d0bd4ce98c 100644 --- a/src/components/Layouts/Primary/TopBar/NotificationMenu/NotificationMenu.tsx +++ b/src/components/Layouts/Primary/TopBar/NotificationMenu/NotificationMenu.tsx @@ -13,7 +13,6 @@ import React, { ReactElement, useEffect, useState } from 'react'; import NotificationsIcon from '@material-ui/icons/Notifications'; import { gql, useMutation, useLazyQuery } from '@apollo/client'; import { useTranslation } from 'react-i18next'; -import { cloneDeep } from 'lodash/fp'; import { useApp } from '../../../../App'; import { GetNotificationsQuery } from '../../../../../../types/GetNotificationsQuery'; import { AcknowledgeAllUserNotificationsMutation } from '../../../../../../types/AcknowledgeAllUserNotificationsMutation'; @@ -105,7 +104,12 @@ const NotificationMenu = (): ReactElement => { after: null, }, }; - const data = cloneDeep(cache.readQuery(query)); + const dataFromCache = cache.readQuery(query); + const data = { + userNotifications: { + ...dataFromCache.userNotifications, + }, + }; data.userNotifications.unreadCount = 0; data.userNotifications.edges = data.userNotifications.edges.map( ({ node }) => ({ diff --git a/src/components/Layouts/Primary/TopBar/TopBar.tsx b/src/components/Layouts/Primary/TopBar/TopBar.tsx index 0bc8fd6f20..a0e67837ab 100644 --- a/src/components/Layouts/Primary/TopBar/TopBar.tsx +++ b/src/components/Layouts/Primary/TopBar/TopBar.tsx @@ -26,7 +26,6 @@ import MenuIcon from '@material-ui/icons/Menu'; import clsx from 'clsx'; import { useTranslation } from 'react-i18next'; import { signout } from 'next-auth/client'; -import { compact } from 'lodash/fp'; import NextLink from 'next/link'; import { GetTopBarQuery } from '../../../../../types/GetTopBarQuery'; import { SIDE_BAR_MINIMIZED_WIDTH, SIDE_BAR_WIDTH } from '../SideBar/SideBar'; @@ -366,9 +365,9 @@ const TopBar = ({ open, handleOpenChange }: Props): ReactElement => { {data.user.firstName[0]} @@ -400,7 +399,7 @@ const TopBar = ({ open, handleOpenChange }: Props): ReactElement => { {(data?.user?.admin || - !!data?.user?.administrativeOrganizations?.nodes?.length) && ( + data?.user?.administrativeOrganizations?.nodes?.length) && ( diff --git a/src/components/Task/Drawer/CommentList/CommentList.tsx b/src/components/Task/Drawer/CommentList/CommentList.tsx index dd6ea1fdb4..3af0857450 100644 --- a/src/components/Task/Drawer/CommentList/CommentList.tsx +++ b/src/components/Task/Drawer/CommentList/CommentList.tsx @@ -2,7 +2,6 @@ import React, { ReactElement, useRef, useEffect } from 'react'; import { makeStyles, Theme, Box, Card, CardContent } from '@material-ui/core'; import { useTranslation } from 'react-i18next'; import { gql, useQuery } from '@apollo/client'; -import { reduce } from 'lodash/fp'; import { GetCommentsForTaskDrawerCommentListQuery } from '../../../../../types/GetCommentsForTaskDrawerCommentListQuery'; import illustration4 from '../../../../images/drawkit/grape/drawkit-grape-pack-illustration-4.svg'; import TaskDrawerCommentListItem from './Item'; @@ -104,27 +103,21 @@ const TaskDrawerCommentList = ({ )} {data.task.comments.nodes.length > 0 && - reduce( - (result, comment) => { - return [ - ...result, - - - , - ]; - }, - [], - data.task.comments.nodes, - )} + data.task.comments.nodes.reduce((result, comment) => { + return [ + ...result, + + + , + ]; + }, [])} )} diff --git a/src/components/Task/Drawer/CommentList/Form/Form.tsx b/src/components/Task/Drawer/CommentList/Form/Form.tsx index 14e4ad7031..beaa5b34ad 100644 --- a/src/components/Task/Drawer/CommentList/Form/Form.tsx +++ b/src/components/Task/Drawer/CommentList/Form/Form.tsx @@ -13,7 +13,7 @@ import * as yup from 'yup'; import SendIcon from '@material-ui/icons/Send'; import { useMutation, gql } from '@apollo/client'; import { motion } from 'framer-motion'; -import { cloneDeep, reject } from 'lodash/fp'; +import reject from 'lodash/fp/reject'; import { v4 as uuidv4 } from 'uuid'; import { CreateTaskCommentMutation } from '../../../../../../types/CreateTaskCommentMutation'; import { TaskCommentCreateInput } from '../../../../../../types/globalTypes'; @@ -125,16 +125,24 @@ const Form = ({ accountListId, taskId }: Props): ReactElement => { taskId, }, }; - const data = cloneDeep( - cache.readQuery(query), + const dataFromCache = cache.readQuery( + query, ); - data.task.comments.nodes = [ - ...reject( - ({ id: commentId }) => id === commentId, - data.task.comments.nodes, - ), - comment, - ]; + const data = { + task: { + ...dataFromCache.task, + comments: { + ...dataFromCache.task.comments, + nodes: [ + ...reject( + ({ id: commentId }) => id === commentId, + dataFromCache.task.comments.nodes, + ), + { ...comment }, + ], + }, + }, + }; cache.writeQuery({ ...query, data }); }, }); diff --git a/src/components/Task/Drawer/CommentList/Item/Item.tsx b/src/components/Task/Drawer/CommentList/Item/Item.tsx index fcaf37b01a..1023c1402c 100644 --- a/src/components/Task/Drawer/CommentList/Item/Item.tsx +++ b/src/components/Task/Drawer/CommentList/Item/Item.tsx @@ -9,7 +9,6 @@ import { Slide, } from '@material-ui/core'; import { formatDistanceToNow, isSameHour } from 'date-fns'; -import { compact } from 'lodash/fp'; import { Skeleton } from '@material-ui/lab'; import { GetCommentsForTaskDrawerCommentListQuery_task_comments_nodes as Comment } from '../../../../../../types/GetCommentsForTaskDrawerCommentListQuery'; @@ -103,11 +102,13 @@ const TaskDrawerCommentListItem = ({ return ( {!reverse && ( diff --git a/src/components/Task/Drawer/ContactList/ContactList.tsx b/src/components/Task/Drawer/ContactList/ContactList.tsx index f04229f6af..14c5ec10f4 100644 --- a/src/components/Task/Drawer/ContactList/ContactList.tsx +++ b/src/components/Task/Drawer/ContactList/ContactList.tsx @@ -9,7 +9,6 @@ import { } from '@material-ui/core'; import { useTranslation } from 'react-i18next'; import { gql, useLazyQuery } from '@apollo/client'; -import { sortBy } from 'lodash/fp'; import { GetContactsForTaskDrawerContactListQuery } from '../../../../../types/GetContactsForTaskDrawerContactListQuery'; import illustration4 from '../../../../images/drawkit/grape/drawkit-grape-pack-illustration-4.svg'; import TaskDrawerContactListItem from './Item'; @@ -144,15 +143,17 @@ const TaskDrawerContactList = ({ )} {data?.contacts?.nodes && data.contacts.nodes.length > 0 && ( - {sortBy('name', data.contacts.nodes).map((contact) => ( - - - - ))} + {[...data.contacts.nodes] + .sort((a, b) => a.name.localeCompare(b.name)) + .map((contact) => ( + + + + ))} )} diff --git a/src/components/Task/Drawer/ContactList/Item/Item.tsx b/src/components/Task/Drawer/ContactList/Item/Item.tsx index ffcf817ae8..c630cb80d4 100644 --- a/src/components/Task/Drawer/ContactList/Item/Item.tsx +++ b/src/components/Task/Drawer/ContactList/Item/Item.tsx @@ -18,7 +18,6 @@ import { Divider, } from '@material-ui/core'; import { useTranslation } from 'react-i18next'; -import { compact } from 'lodash/fp'; import CallIcon from '@material-ui/icons/Call'; import TextsmsIcon from '@material-ui/icons/Textsms'; import EmailIcon from '@material-ui/icons/Email'; @@ -144,12 +143,14 @@ const TaskDrawerContactListItem = ({ contact }: Props): ReactElement => { @@ -176,12 +177,14 @@ const TaskDrawerContactListItem = ({ contact }: Props): ReactElement => { variant="body2" color="textPrimary" > - {compact([ + {[ contact.primaryPerson.title, contact.primaryPerson.firstName, contact.primaryPerson.lastName, contact.primaryPerson.suffix, - ]).join(' ')} + ] + .filter(Boolean) + .join(' ')} {contact.primaryPerson.primaryEmailAddress.location && ` — ${contact.primaryPerson.primaryEmailAddress.location}`} @@ -212,12 +215,14 @@ const TaskDrawerContactListItem = ({ contact }: Props): ReactElement => { variant="body2" color="textPrimary" > - {compact([ + {[ contact.primaryPerson.title, contact.primaryPerson.firstName, contact.primaryPerson.lastName, contact.primaryPerson.suffix, - ]).join(' ')} + ] + .filter(Boolean) + .join(' ')} {contact.primaryPerson.primaryPhoneNumber.location && ` — ${contact.primaryPerson.primaryPhoneNumber.location}`} diff --git a/src/components/Task/Drawer/Form/Form.mock.tsx b/src/components/Task/Drawer/Form/Form.mock.tsx index 5af469823c..080730175e 100644 --- a/src/components/Task/Drawer/Form/Form.mock.tsx +++ b/src/components/Task/Drawer/Form/Form.mock.tsx @@ -1,5 +1,4 @@ import { MockedResponse } from '@apollo/client/testing'; -import { omit } from 'lodash/fp'; import { addHours, startOfHour } from 'date-fns'; import { GetDataForTaskDrawerQuery } from '../../../../../types/GetDataForTaskDrawerQuery'; import { CreateTaskMutation } from '../../../../../types/CreateTaskMutation'; @@ -77,17 +76,19 @@ export const createTaskMutationMock = (): MockedResponse => { task: { ...task, id: 'task-1' }, }, }; - const attributes: TaskCreateInput = omit(['contacts', 'user'], { - ...task, + const { contacts: _contacts, user: _user, id: _id, ...createTask } = task; + const attributes: TaskCreateInput = { + ...createTask, userId: null, contactIds: [], - }); + }; + return { request: { query: CREATE_TASK_MUTATION, variables: { accountListId: 'abc', - attributes: omit('id', attributes), + attributes, }, }, result: { data }, @@ -118,11 +119,12 @@ export const updateTaskMutationMock = (): MockedResponse => { task, }, }; - const attributes: TaskUpdateInput = omit(['contacts', 'user'], { - ...task, + const { contacts: _contacts, user: _user, ...updateTask } = task; + const attributes: TaskUpdateInput = { + ...updateTask, userId: task.user.id, contactIds: task.contacts.nodes.map(({ id }) => id), - }); + }; return { request: { query: UPDATE_TASK_MUTATION, diff --git a/src/components/Task/Drawer/Form/Form.tsx b/src/components/Task/Drawer/Form/Form.tsx index a33d9cea4a..744efee9a9 100644 --- a/src/components/Task/Drawer/Form/Form.tsx +++ b/src/components/Task/Drawer/Form/Form.tsx @@ -23,7 +23,6 @@ import { motion, AnimatePresence } from 'framer-motion'; import { Formik } from 'formik'; import * as yup from 'yup'; import { gql, useQuery, useMutation } from '@apollo/client'; -import { omit, sortBy } from 'lodash/fp'; import { useSnackbar } from 'notistack'; import { startOfHour, addHours } from 'date-fns'; import { @@ -239,17 +238,31 @@ const TaskDrawerForm = ({ UPDATE_TASK_MUTATION, ); const onSubmit = async (values: Task): Promise => { - const attributes = omit(['contacts', 'user', '__typename'], { + const attributes = { ...values, userId: values.user?.id || null, contactIds: values.contacts.nodes.map(({ id }) => id), - }); + }; + try { if (task) { - await updateTask({ variables: { accountListId, attributes } }); + const { + contacts: _contacts, + user: _user, + ...updateTaskAttributes + } = attributes; + await updateTask({ + variables: { accountListId, attributes: updateTaskAttributes }, + }); } else { + const { + id: _id, + contacts: _contacts, + user: _user, + ...createTaskAttributes + } = attributes; await createTask({ - variables: { accountListId, attributes: omit('id', attributes) }, + variables: { accountListId, attributes: createTaskAttributes }, }); } enqueueSnackbar(t('Task saved successfully'), { variant: 'success' }); @@ -466,7 +479,9 @@ const TaskDrawerForm = ({ multiple options={ (data?.contacts?.nodes && - sortBy('name', data.contacts.nodes)) || + [...data.contacts.nodes].sort((a, b) => + a.name.localeCompare(b.name), + )) || [] } getOptionLabel={({ diff --git a/src/components/Task/List/List.tsx b/src/components/Task/List/List.tsx index a32fe5fc77..70245e29be 100644 --- a/src/components/Task/List/List.tsx +++ b/src/components/Task/List/List.tsx @@ -17,7 +17,7 @@ import { FormLabel, Box, } from '@material-ui/core'; -import { find, reduce } from 'lodash/fp'; +import reduce from 'lodash/fp/reduce'; import debounce from 'lodash/fp/debounce'; import { Skeleton } from '@material-ui/lab'; import { DatePicker } from '@material-ui/pickers'; @@ -240,7 +240,9 @@ const TaskList = ({ initialFilter }: Props): ReactElement => { customFilterListOptions: { render: (id): string => { if (filterData?.contacts?.nodes) { - return find({ id }, filterData.contacts.nodes)?.name; + return filterData.contacts.nodes.find( + ({ id: contactId }) => contactId === id, + )?.name; } return t('Loading'); }, @@ -249,7 +251,9 @@ const TaskList = ({ initialFilter }: Props): ReactElement => { names: filterData?.contacts?.nodes?.map(({ id }) => id) || [], renderValue: (id): string => { if (filterData?.contacts?.nodes) { - return find({ id }, filterData.contacts.nodes)?.name; + return filterData.contacts.nodes.find( + ({ id: contactId }) => contactId === id, + )?.name; } }, fullWidth: true, @@ -315,9 +319,9 @@ const TaskList = ({ initialFilter }: Props): ReactElement => { customFilterListOptions: { render: (id): string => { if (filterData?.accountListUsers?.nodes) { - const accountListUser = find( - { user: { id } }, - filterData.accountListUsers.nodes, + const accountListUser = filterData.accountListUsers.nodes.find( + ({ user: { id: accountListUserId } }) => + accountListUserId === id, ); return `${accountListUser.user.firstName} ${accountListUser.user.lastName}`; } @@ -331,9 +335,9 @@ const TaskList = ({ initialFilter }: Props): ReactElement => { ) || [], renderValue: (id): string => { if (filterData?.accountListUsers?.nodes) { - const accountListUser = find( - { user: { id } }, - filterData.accountListUsers.nodes, + const accountListUser = filterData.accountListUsers.nodes.find( + ({ user: { id: accountListUserId } }) => + accountListUserId === id, ); return `${accountListUser.user.firstName} ${accountListUser.user.lastName}`; } diff --git a/src/components/Task/Status/Status.tsx b/src/components/Task/Status/Status.tsx index a463e2f2b3..7ef51146c6 100644 --- a/src/components/Task/Status/Status.tsx +++ b/src/components/Task/Status/Status.tsx @@ -6,7 +6,6 @@ import AssignmentIcon from '@material-ui/icons/Assignment'; import AssignmentTurnedInIcon from '@material-ui/icons/AssignmentTurnedIn'; import { green, orange } from '@material-ui/core/colors'; import { useTranslation } from 'react-i18next'; -import { compact } from 'lodash/fp'; import DoneIcon from '@material-ui/icons/Done'; import { useApp } from '../../App'; @@ -187,11 +186,13 @@ const TaskStatus = ({ disableTouchListener={disableTooltip} > diff --git a/src/lib/intlFormat/intlFormat.ts b/src/lib/intlFormat/intlFormat.ts index b22a56acec..28bb684c8a 100644 --- a/src/lib/intlFormat/intlFormat.ts +++ b/src/lib/intlFormat/intlFormat.ts @@ -1,5 +1,3 @@ -import { isFinite, isNil } from 'lodash/fp'; - const getLanguage = (): string => { const language = (typeof window !== 'undefined' && window.navigator.language) || 'en-US'; @@ -9,7 +7,7 @@ const getLanguage = (): string => { export const numberFormat = (value: number, language = getLanguage()): string => new Intl.NumberFormat(language, { style: 'decimal', - }).format(isFinite(value) ? value : 0); + }).format(Number.isFinite(value) ? value : 0); export const percentageFormat = ( value: number, @@ -17,7 +15,7 @@ export const percentageFormat = ( ): string => new Intl.NumberFormat(language, { style: 'percent', - }).format(isFinite(value) ? value : 0); + }).format(Number.isFinite(value) ? value : 0); export const currencyFormat = ( value: number, @@ -27,10 +25,12 @@ export const currencyFormat = ( ): string => new Intl.NumberFormat(language, { style: 'currency', - currency: isNil(currency) ? 'USD' : currency, + currency: currency ?? 'USD', minimumFractionDigits, }).format( - isFinite(value) ? parseFloat(value.toFixed(minimumFractionDigits)) : 0, + Number.isFinite(value) + ? parseFloat(value.toFixed(minimumFractionDigits)) + : 0, ); export const dayMonthFormat = ( diff --git a/src/lib/reduceObject/index.ts b/src/lib/reduceObject/index.ts deleted file mode 100644 index a78c52841d..0000000000 --- a/src/lib/reduceObject/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import reduceObject from './reduceObject'; - -export default reduceObject; diff --git a/src/lib/reduceObject/reduceObject.test.ts b/src/lib/reduceObject/reduceObject.test.ts deleted file mode 100644 index 0154477f3d..0000000000 --- a/src/lib/reduceObject/reduceObject.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { isFunction } from 'lodash/fp'; -import reduceObject from './reduceObject'; - -const obj = { - a: 'b', -}; - -describe('common.fp.reduceObject', () => { - it('should curry', () => { - expect(isFunction(reduceObject())).toEqual(true); - }); - - it('should create an object', () => { - expect( - reduceObject( - (result, value, key) => { - result[key] = value; - return result; - }, - {}, - obj, - ), - ).toEqual({ a: 'b' }); - }); -}); diff --git a/src/lib/reduceObject/reduceObject.ts b/src/lib/reduceObject/reduceObject.ts deleted file mode 100644 index 6392e8fc52..0000000000 --- a/src/lib/reduceObject/reduceObject.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { curry, reduce } from 'lodash/fp'; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const reduceObject = (reduce as any).convert({ cap: false }); - -export default curry((a, b, c) => reduceObject(a, b, c));