Skip to content

Commit 9b9ea93

Browse files
committed
Migate from lodash to lodash-es in the few remaining uses
1 parent 4a6c0a7 commit 9b9ea93

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

src/components/modules/download-button/download-dropdown.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use client';
22

3-
import sortBy from 'lodash/sortBy';
4-
import partition from 'lodash/partition';
3+
import { sortBy, partition } from 'lodash-es';
54
import { useEffect, useMemo, useState } from 'react';
65

76
import { styled } from '@linaria/react';

src/components/modules/table-content/components/table-content-fixed.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import kebabCase from 'lodash/kebabCase';
3+
import { kebabCase } from 'lodash-es';
44

55
import { TableContentTriggerComponent } from './table-content-trigger';
66
import useActiveToc from '../hooks/use-active-toc';

src/components/sections/bento/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chunk from 'lodash/chunk';
1+
import { chunk } from 'lodash-es';
22

33
import { styled } from '@linaria/react';
44

src/lib/mdx/utils/groups-to-links.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import kebabCase from 'lodash/kebabCase';
1+
import { kebabCase } from 'lodash-es';
22

33
import type { HeadingGroupWithSubItems } from './group-by-level';
44

src/lib/services/get-github-download-stats.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import sum from 'lodash/sum';
2-
31
import { GITHUB_ORG } from '../constants/github';
42
import { siteMetadata } from '../site-metadata';
53

@@ -32,8 +30,10 @@ export async function getGithubDownloadStats(): Promise<number> {
3230
else pageIndex += 1;
3331
}
3432

35-
const totalDownloads = sum(
36-
releases.map((release: any) => sum(release.assets.map((asset: any) => asset.download_count))),
33+
const totalDownloads = releases.reduce(
34+
(total: number, release: any) =>
35+
total + release.assets.reduce((a: number, asset: any) => a + asset.download_count, 0),
36+
0,
3737
);
3838

3939
return (cachedDownloadState = totalDownloads);

0 commit comments

Comments
 (0)