Skip to content

Commit

Permalink
Replace lodash.chunk (#4372)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Dec 29, 2024
1 parent 015e58a commit ebae0bf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
9 changes: 8 additions & 1 deletion lib/plugins/html/htmlBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { markdown } from 'markdown';
import merge from 'lodash.merge';
import get from 'lodash.get';
import isEmpty from 'lodash.isempty';
import chunk from 'lodash.chunk';

const getOS = promisify(getos);
const log = intel.getLogger('sitespeedio.plugin.html');
Expand All @@ -37,6 +36,14 @@ import { toArray } from '../../support/util.js';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';

function chunk(array, size) {
const out = [];
for (let i = 0; i < array.length; i += size) {
out.push(array.slice(i, i + size));
}
return out;
}

export class HTMLBuilder {
constructor(context, options) {
this.storageManager = context.storageManager;
Expand Down
9 changes: 8 additions & 1 deletion lib/plugins/text/textBuilder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import table from 'text-table';
import clic from 'cli-color';
import chunk from 'lodash.chunk';

import { plural, short, cap } from '../../support/helpers/index.js';
import summaryBoxesSetup from '../html/setup/summaryBoxes.js';
Expand All @@ -11,6 +10,14 @@ const tableOptions = {
};
const drab = blackBright;

function chunk(array, size) {
const out = [];
for (let i = 0; i < array.length; i += size) {
out.push(array.slice(i, i + size));
}
return out;
}

function getMarker(label) {
return { ok: '√', warning: '!', error: '✗', info: '' }[label] || '';
}
Expand Down
6 changes: 0 additions & 6 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"intel": "1.2.0",
"jstransformer-markdown-it": "3.0.0",
"junit-report-builder": "3.2.1",
"lodash.chunk": "4.2.0",
"lodash.clonedeep": "4.5.0",
"lodash.foreach": "4.5.0",
"lodash.get": "4.4.2",
Expand Down

0 comments on commit ebae0bf

Please sign in to comment.