From a671c851ab2b60a2b06b23bbc57f6307ca38db3a Mon Sep 17 00:00:00 2001 From: Gajus Kuizinas Date: Thu, 4 Nov 2021 09:18:40 -0500 Subject: [PATCH] fix: remove unnecessary cloneDeep --- package.json | 2 -- src/makeStreamConfig.ts | 7 ++----- src/makeTableConfig.ts | 7 ++----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 24318f7..604513d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ }, "dependencies": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", @@ -15,7 +14,6 @@ "description": "Formats data into a string table.", "devDependencies": { "@types/chai": "^4.2.16", - "@types/lodash.clonedeep": "^4.5.6", "@types/lodash.mapvalues": "^4.6.6", "@types/lodash.truncate": "^4.4.6", "@types/mocha": "^8.2.2", diff --git a/src/makeStreamConfig.ts b/src/makeStreamConfig.ts index ffa5dc0..32cbd90 100644 --- a/src/makeStreamConfig.ts +++ b/src/makeStreamConfig.ts @@ -1,4 +1,3 @@ -import cloneDeep from 'lodash.clonedeep'; import type { ColumnUserConfig, Indexable, @@ -40,10 +39,8 @@ const makeColumnsConfig = (columnCount: number, * Makes a new configuration object out of the userConfig object * using default values for the missing configuration properties. */ -export const makeStreamConfig = (userConfig: StreamUserConfig): StreamConfig => { - validateConfig('streamConfig.json', userConfig); - - const config = cloneDeep(userConfig); +export const makeStreamConfig = (config: StreamUserConfig): StreamConfig => { + validateConfig('streamConfig.json', config); if (config.columnDefault.width === undefined) { throw new Error('Must provide config.columnDefault.width when creating a stream.'); diff --git a/src/makeTableConfig.ts b/src/makeTableConfig.ts index ec4f9b4..535df30 100644 --- a/src/makeTableConfig.ts +++ b/src/makeTableConfig.ts @@ -1,4 +1,3 @@ -import cloneDeep from 'lodash.clonedeep'; import calculateColumnWidths from './calculateColumnWidths'; import type { ColumnUserConfig, Indexable, @@ -58,10 +57,8 @@ const makeHeaderConfig = (config: TableUserConfig): HeaderConfig | undefined => * using default values for the missing configuration properties. */ -export const makeTableConfig = (rows: Row[], userConfig: TableUserConfig = {}): TableConfig => { - validateConfig('config.json', userConfig); - - const config = cloneDeep(userConfig); +export const makeTableConfig = (rows: Row[], config: TableUserConfig = {}): TableConfig => { + validateConfig('config.json', config); return { ...config,