Skip to content

Commit

Permalink
fix: remove unnecessary cloneDeep
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Nov 4, 2021
1 parent 0911596 commit a671c85
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
7 changes: 2 additions & 5 deletions src/makeStreamConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cloneDeep from 'lodash.clonedeep';
import type {
ColumnUserConfig,
Indexable,
Expand Down Expand Up @@ -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.');
Expand Down
7 changes: 2 additions & 5 deletions src/makeTableConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cloneDeep from 'lodash.clonedeep';
import calculateColumnWidths from './calculateColumnWidths';
import type {
ColumnUserConfig, Indexable,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a671c85

Please sign in to comment.