Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lodash.times as a dependency #138

Merged
merged 3 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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