From 980163655f4aefb078e78462918cbcdb091cfaa4 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 16 Oct 2023 13:23:57 +0300 Subject: [PATCH 1/5] Remove lodash lowerFirst/upperFirs utils usage --- workers/loc.api/generate-csv/index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/workers/loc.api/generate-csv/index.js b/workers/loc.api/generate-csv/index.js index e5b861bd..492536f8 100644 --- a/workers/loc.api/generate-csv/index.js +++ b/workers/loc.api/generate-csv/index.js @@ -1,10 +1,5 @@ 'use strict' -const { - upperFirst, - lowerFirst -} = require('lodash') - const { checkFilterParams, FILTER_MODELS_NAMES, @@ -58,7 +53,8 @@ const _getCsvStoreStatus = async ({ const _filterModelNameMap = Object.values(FILTER_MODELS_NAMES) .reduce((map, name) => { - const key = `get${upperFirst(name)}CsvJobData` + const baseName = `${name[0].toUpperCase()}${name.slice(1)}` + const key = `get${baseName}CsvJobData` map.set(key, name) @@ -74,7 +70,7 @@ const _truncateCsvNameEnding = (name) => { .replace(/^get/i, '') .replace(/csv$/i, '') - return lowerFirst(cleanedName) + return `${cleanedName[0].toLowerCase()}${cleanedName.slice(1)}` } const _getFilterModelNamesAndArgs = ( From 464303f4813d0c6f5403f9d174a59cf7417ec490 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 16 Oct 2023 13:24:29 +0300 Subject: [PATCH 2/5] Remove lodash snakeCase util usage --- .../loc.api/queue/helpers/get-complete-file-name.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/workers/loc.api/queue/helpers/get-complete-file-name.js b/workers/loc.api/queue/helpers/get-complete-file-name.js index a743dfd1..1c44805b 100644 --- a/workers/loc.api/queue/helpers/get-complete-file-name.js +++ b/workers/loc.api/queue/helpers/get-complete-file-name.js @@ -1,6 +1,5 @@ 'use strict' -const { snakeCase } = require('lodash') const { v4: uuidv4 } = require('uuid') const _fileNamesMap = new Map([ @@ -67,10 +66,15 @@ const _getBaseName = ( if (isMultiExport) { return 'multiple-exports' } + if (namesMap.has(queueName)) { + return namesMap.get(queueName) + } - return namesMap.has(queueName) - ? namesMap.get(queueName) - : snakeCase(queueName.replace(/^get/, '')) + return queueName + .replace(/^get/, '') + .replace(/[A-Z]/g, (match, offset) => ( + `${offset > 0 ? '_' : ''}${match.toLowerCase()}` + )) } const _getDateString = mc => { From 5c1971f0ed7db6fc6447afe31b32b70eb86f7244 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 16 Oct 2023 13:25:00 +0300 Subject: [PATCH 3/5] Use isEmpty util form lib-js-util-base --- .../helpers/prepare-response/helpers/get-symbol-params.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workers/loc.api/helpers/prepare-response/helpers/get-symbol-params.js b/workers/loc.api/helpers/prepare-response/helpers/get-symbol-params.js index e5861645..48a85599 100644 --- a/workers/loc.api/helpers/prepare-response/helpers/get-symbol-params.js +++ b/workers/loc.api/helpers/prepare-response/helpers/get-symbol-params.js @@ -1,6 +1,6 @@ 'use strict' -const { isEmpty } = require('lodash') +const { isEmpty } = require('lib-js-util-base') const { LedgerPaymentFilteringParamsError From 3ce6a56f3431031a965ac7e9c69f31cff6dc3905 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 16 Oct 2023 13:25:35 +0300 Subject: [PATCH 4/5] Remove lodash from deps --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 48ff1fef..9d03a1d2 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "inversify": "6.0.1", "js-yaml": "4.1.0", "lib-js-util-base": "git+https://github.com/bitfinexcom/lib-js-util-base.git", - "lodash": "4.17.21", "lru": "3.1.0", "moment": "2.29.4", "moment-timezone": "0.5.39", From 539da3b71e3e23c3dc2d8050572f39f0ef6c3d26 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 31 Oct 2023 11:29:02 +0200 Subject: [PATCH 5/5] Bump version up to 4.8.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d03a1d2..88cf1c12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report", - "version": "4.8.0", + "version": "4.8.1", "description": "Reporting tool", "main": "worker.js", "license": "Apache-2.0",