Skip to content

Commit 89a832e

Browse files
authored
Merge pull request desktop#17496 from desktop/lower-dash
Avoid importing all of lodash
2 parents 282a8d6 + 099fc60 commit 89a832e

18 files changed

+27
-25
lines changed

app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"fs-admin": "^0.19.0",
3939
"fuzzaldrin-plus": "^0.6.0",
4040
"keytar": "^7.8.0",
41+
"lodash": "^4.17.21",
4142
"marked": "^4.0.10",
4243
"mem": "^4.3.0",
4344
"memoize-one": "^4.0.3",

app/src/lib/markdown-filters/commit-mention-link-filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { escapeRegExp } from 'lodash'
1+
import escapeRegExp from 'lodash/escapeRegExp'
22
import { GitHubRepository } from '../../models/github-repository'
33
import { getHTMLURL } from '../api'
44
import { INodeFilter } from './node-filter'

app/src/lib/markdown-filters/emoji-filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { INodeFilter } from './node-filter'
22
import { fileURLToPath } from 'url'
33
import { readFile } from 'fs/promises'
4-
import { escapeRegExp } from 'lodash'
4+
import escapeRegExp from 'lodash/escapeRegExp'
55

66
/**
77
* The Emoji Markdown filter will take a text node and create multiple text and

app/src/lib/markdown-filters/issue-link-filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { escapeRegExp } from 'lodash'
1+
import escapeRegExp from 'lodash/escapeRegExp'
22
import { GitHubRepository } from '../../models/github-repository'
33
import { getHTMLURL } from '../api'
44
import { INodeFilter } from './node-filter'

app/src/lib/markdown-filters/video-url-regex.ts

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

33
const user_images_cdn_url = 'https://user-images.githubusercontent.com'
44

app/src/lib/stores/commit-status-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
getCheckRunActionsWorkflowRuns,
1818
manuallySetChecksToPending,
1919
} from '../ci-checks/ci-checks'
20-
import _ from 'lodash'
20+
import xor from 'lodash/xor'
2121
import { offsetFromNow } from '../offset-from'
2222

2323
interface ICommitStatusCacheEntry {
@@ -343,7 +343,7 @@ export class CommitStatusStore {
343343
existingChecks !== undefined &&
344344
existingChecks.check !== null &&
345345
existingChecks.check.checks.some(c => c.actionsWorkflow !== undefined) &&
346-
_.xor(
346+
xor(
347347
existingChecks.check.checks.map(cr => cr.id),
348348
checks.map(cr => cr.id)
349349
).length === 0

app/src/lib/unique-coauthors-as-authors.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
import _ from 'lodash'
1+
import uniqWith from 'lodash/uniqWith'
22
import { KnownAuthor } from '../models/author'
33
import { Commit } from '../models/commit'
4-
import { GitAuthor } from '../models/git-author'
54

65
export function getUniqueCoauthorsAsAuthors(
76
commits: ReadonlyArray<Commit>
87
): ReadonlyArray<KnownAuthor> {
9-
const allCommitsCoAuthors: GitAuthor[] = _.flatten(
10-
commits.map(c => c.coAuthors)
11-
)
8+
const allCommitsCoAuthors = commits.flatMap(c => c.coAuthors)
129

13-
const uniqueCoAuthors = _.uniqWith(
10+
const uniqueCoAuthors = uniqWith(
1411
allCommitsCoAuthors,
1512
(a, b) => a.email === b.email && a.name === b.name
1613
)

app/src/main-process/desktop-file-transport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import TransportStream, { TransportStreamOptions } from 'winston-transport'
55
import { EOL } from 'os'
66
import { readdir, unlink } from 'fs/promises'
77
import { promisify } from 'util'
8-
import { escapeRegExp } from 'lodash'
8+
import escapeRegExp from 'lodash/escapeRegExp'
99

1010
type DesktopFileTransportOptions = TransportStreamOptions & {
1111
readonly logDirectory: string

app/src/main-process/log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as winston from 'winston'
22
import { getLogDirectoryPath } from '../lib/logging/get-log-path'
33
import { LogLevel } from '../lib/logging/log-level'
4-
import { noop } from 'lodash'
4+
import noop from 'lodash/noop'
55
import { DesktopConsoleTransport } from './desktop-console-transport'
66
import memoizeOne from 'memoize-one'
77
import { mkdir } from 'fs/promises'

app/src/ui/accessibility/aria-live-container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { debounce } from 'lodash'
1+
import debounce from 'lodash/debounce'
22
import React, { Component } from 'react'
33

44
interface IAriaLiveContainerProps {

0 commit comments

Comments
 (0)