Skip to content

Commit

Permalink
fix: remove lodash.times as a dependency (#138)
Browse files Browse the repository at this point in the history
* Remove lodash.times

* Update package.json

Co-authored-by: Gajus Kuizinas <gajus@gajus.com>
  • Loading branch information
realityking and gajus authored Mar 29, 2021
1 parent 5c8528d commit 17d4440
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"is-string": "^1.0.5",
"lodash.clonedeep": "^4.5.0",
"lodash.flatten": "^4.4.0",
"lodash.times": "^4.3.2",
"lodash.truncate": "^4.4.2",
"slice-ansi": "^4.0.0",
"string-width": "^4.2.0"
Expand Down
5 changes: 2 additions & 3 deletions src/makeConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cloneDeep from 'lodash.clonedeep';
import times from 'lodash.times';
import calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex';
import getBorderCharacters from './getBorderCharacters';
import validateConfig from './validateConfig';
Expand All @@ -26,7 +25,7 @@ const makeBorder = (border = {}) => {
const makeColumns = (rows, columns = {}, columnDefault = {}) => {
const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows);

times(rows[0].length, (index) => {
for (let index = 0; index < rows[0].length; index++) {
if (typeof columns[index] === 'undefined') {
columns[index] = {};
}
Expand All @@ -39,7 +38,7 @@ const makeColumns = (rows, columns = {}, columnDefault = {}) => {
width: maximumColumnWidthIndex[index],
wrapWord: false,
}, columnDefault, columns[index]);
});
}

return columns;
};
Expand Down
5 changes: 2 additions & 3 deletions src/makeStreamConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cloneDeep from 'lodash.clonedeep';
import times from 'lodash.times';
import getBorderCharacters from './getBorderCharacters';
import validateConfig from './validateConfig';

Expand All @@ -23,7 +22,7 @@ const makeBorder = (border = {}) => {
* @returns {object}
*/
const makeColumns = (columnCount, columns = {}, columnDefault = {}) => {
times(columnCount, (index) => {
for (let index = 0; index < columnCount; index++) {
if (typeof columns[index] === 'undefined') {
columns[index] = {};
}
Expand All @@ -35,7 +34,7 @@ const makeColumns = (columnCount, columns = {}, columnDefault = {}) => {
truncate: Number.POSITIVE_INFINITY,
wrapWord: false,
}, columnDefault, columns[index]);
});
}

return columns;
};
Expand Down
3 changes: 1 addition & 2 deletions src/mapDataUsingRowHeightIndex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import flatten from 'lodash.flatten';
import times from 'lodash.times';
import wrapCell from './wrapCell';

/**
Expand All @@ -12,7 +11,7 @@ export default (unmappedRows, rowHeightIndex, config) => {
const tableWidth = unmappedRows[0].length;

const mappedRows = unmappedRows.map((cells, index0) => {
const rowHeight = times(rowHeightIndex[index0], () => {
const rowHeight = Array.from(new Array(rowHeightIndex[index0]), () => {
return new Array(tableWidth).fill('');
});

Expand Down

0 comments on commit 17d4440

Please sign in to comment.