Skip to content

Commit

Permalink
chore: change lodash to lodash-es
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Imports of `lodash` are now `lodash-es`

re #107
  • Loading branch information
lzear committed Feb 27, 2024
1 parent 4e1b432 commit a3074f0
Show file tree
Hide file tree
Showing 26 changed files with 38 additions and 33 deletions.
2 changes: 1 addition & 1 deletion votes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"dependencies": {
"javascript-lp-solver": "0.4.15",
"lodash": "^4.17.21"
"lodash-es": "^4.17.21"
},
"peerDependencies": {
"javascript-lp-solver": ">=0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion votes/src/classes/method.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

import { scoresToRanking } from '../utils/scores'

Expand Down
2 changes: 1 addition & 1 deletion votes/src/classes/random-matrix-method.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/classes/random-matrix-method.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/classes/random-matrix-method.ts#L1

Unable to resolve path to module 'lodash-es'.

import type { Matrix, ScoreObject } from '../types'
import { shuffleArray } from '../utils/shuffle-array'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/baldwin/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/methods/baldwin/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/baldwin/index.ts#L1

Unable to resolve path to module 'lodash-es'.

import { RoundBallotMethod } from '../../classes/round-ballot-method'
import type { Ballot, ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/biggest-support/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/methods/biggest-support/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/biggest-support/index.ts#L1

Unable to resolve path to module 'lodash-es'.

import { BallotMethod } from '../../classes/ballot-method'
import type { Ballot } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/bottom-two-runoff/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/methods/bottom-two-runoff/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/bottom-two-runoff/index.ts#L1

Unable to resolve path to module 'lodash-es'.

import { RoundBallotMethod } from '../../classes/round-ballot-method'
import type { Ballot, ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/coombs/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/methods/coombs/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/coombs/index.ts#L1

Unable to resolve path to module 'lodash-es'.

import { RoundBallotMethod } from '../../classes/round-ballot-method'
import type { Ballot, ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/copeland/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/methods/copeland/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/copeland/index.ts#L1

Unable to resolve path to module 'lodash-es'.

import { MatrixScoreMethod } from '../../classes/matrix-score-method'
import type { Matrix, ScoreObject } from '../../types'
Expand Down
4 changes: 2 additions & 2 deletions votes/src/methods/kemeny/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import range from 'lodash/range'
import zipObject from 'lodash/zipObject'
import range from 'lodash-es/range'

Check failure on line 1 in votes/src/methods/kemeny/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/kemeny/index.ts#L1

Unable to resolve path to module 'lodash-es/range'.
import zipObject from 'lodash-es/zipObject'

import { MatrixScoreMethod } from '../../classes/matrix-score-method'
import type { Matrix, ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/majority-judgment/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

import { BallotMethod } from '../../classes/ballot-method'
import type { Ballot, ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/maximal-lotteries/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import zipObject from 'lodash/zipObject'
import zipObject from 'lodash-es/zipObject'

Check failure on line 1 in votes/src/methods/maximal-lotteries/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/maximal-lotteries/index.ts#L1

Unable to resolve path to module 'lodash-es/zipObject'.

import { RandomMatrixMethod } from '../../classes/random-matrix-method'
import { findNashEquilibrium } from '../../simplex/find-nash-equilibrium'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/minimax-td/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/methods/minimax-td/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/minimax-td/index.ts#L1

Unable to resolve path to module 'lodash-es'.

import type { Matrix, ScoreObject } from '../../types'
import { findSmithSet } from '../../utils/condorcet'
Expand Down
4 changes: 2 additions & 2 deletions votes/src/methods/nanson/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import sum from 'lodash/sum'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/methods/nanson/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/nanson/index.ts#L1

Unable to resolve path to module 'lodash-es'.
import sum from 'lodash-es/sum'

Check failure on line 2 in votes/src/methods/nanson/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/nanson/index.ts#L2

Unable to resolve path to module 'lodash-es/sum'.

import { RoundBallotMethod } from '../../classes/round-ballot-method'
import type { Ballot, ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/random-candidates/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import zipObject from 'lodash/zipObject'
import zipObject from 'lodash-es/zipObject'

import { RandomMethod } from '../../classes/random-method'
import type { ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/ranked-pairs/generate-acyclic-graph.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/methods/ranked-pairs/generate-acyclic-graph.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/ranked-pairs/generate-acyclic-graph.ts#L1

Unable to resolve path to module 'lodash-es'.

import { Tarjan } from './tarjan'
import { Vertex } from './vertex'
Expand Down
6 changes: 3 additions & 3 deletions votes/src/methods/ranked-pairs/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import groupBy from 'lodash/groupBy'
import range from 'lodash/range'
import zipObject from 'lodash/zipObject'
import groupBy from 'lodash-es/groupBy'

Check failure on line 1 in votes/src/methods/ranked-pairs/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/ranked-pairs/index.ts#L1

Unable to resolve path to module 'lodash-es/groupBy'.
import range from 'lodash-es/range'

Check failure on line 2 in votes/src/methods/ranked-pairs/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/ranked-pairs/index.ts#L2

Unable to resolve path to module 'lodash-es/range'.
import zipObject from 'lodash-es/zipObject'

Check failure on line 3 in votes/src/methods/ranked-pairs/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/methods/ranked-pairs/index.ts#L3

Unable to resolve path to module 'lodash-es/zipObject'.

import { MatrixScoreMethod } from '../../classes/matrix-score-method'
import type { Matrix, ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/schulze/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import range from 'lodash/range'
import range from 'lodash-es/range'

import { MatrixScoreMethod } from '../../classes/matrix-score-method'
import type { Matrix, ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/methods/two-round-runoff/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

import { RoundBallotMethod } from '../../classes/round-ballot-method'
import type { ScoreObject } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/test/matrix.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import range from 'lodash/range'
import range from 'lodash-es/range'

Check failure on line 1 in votes/src/test/matrix.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/test/matrix.ts#L1

Unable to resolve path to module 'lodash-es/range'.

export const product = (a: number[][], b: number[][]): number[][] => {
const dimA = [a.length, a[0].length]
Expand Down
2 changes: 1 addition & 1 deletion votes/src/test/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fill from 'lodash/fill'
import fill from 'lodash-es/fill'

Check failure on line 1 in votes/src/test/test-utils.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/test/test-utils.ts#L1

Unable to resolve path to module 'lodash-es/fill'.

import type { Ballot } from '../types'
import { toWeightedBallots } from '../utils'
Expand Down
2 changes: 1 addition & 1 deletion votes/src/utils/condorcet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/utils/condorcet.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/utils/condorcet.ts#L1

Unable to resolve path to module 'lodash-es'.

import type { Matrix } from '../types'

Expand Down
6 changes: 3 additions & 3 deletions votes/src/utils/make-matrix.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import difference from 'lodash/difference'
import range from 'lodash/range'
import times from 'lodash/times'
import difference from 'lodash-es/difference'

Check failure on line 1 in votes/src/utils/make-matrix.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/utils/make-matrix.ts#L1

Unable to resolve path to module 'lodash-es/difference'.
import range from 'lodash-es/range'

Check failure on line 2 in votes/src/utils/make-matrix.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/utils/make-matrix.ts#L2

Unable to resolve path to module 'lodash-es/range'.
import times from 'lodash-es/times'

Check failure on line 3 in votes/src/utils/make-matrix.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/utils/make-matrix.ts#L3

Unable to resolve path to module 'lodash-es/times'.

import type { Ballot, Matrix } from '../types'

Expand Down
2 changes: 1 addition & 1 deletion votes/src/utils/normalize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import _ from 'lodash-es'

Check failure on line 1 in votes/src/utils/normalize.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/utils/normalize.ts#L1

Unable to resolve path to module 'lodash-es'.

import type { Ballot } from '../types'

Expand Down
2 changes: 1 addition & 1 deletion votes/src/utils/scores-zero.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import zipObject from 'lodash/zipObject'
import zipObject from 'lodash-es/zipObject'

Check failure on line 1 in votes/src/utils/scores-zero.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/utils/scores-zero.ts#L1

Unable to resolve path to module 'lodash-es/zipObject'.

import type { ScoreObject } from '../types'

Expand Down
6 changes: 3 additions & 3 deletions votes/src/utils/scores.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import groupBy from 'lodash/groupBy'
import sortBy from 'lodash/sortBy'
import toPairs from 'lodash/toPairs'
import groupBy from 'lodash-es/groupBy'

Check failure on line 1 in votes/src/utils/scores.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/utils/scores.ts#L1

Unable to resolve path to module 'lodash-es/groupBy'.
import sortBy from 'lodash-es/sortBy'
import toPairs from 'lodash-es/toPairs'

Check failure on line 3 in votes/src/utils/scores.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

votes/src/utils/scores.ts#L3

Unable to resolve path to module 'lodash-es/toPairs'.

export const scoresToRanking = (scores: {
[candidate: string]: number
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9058,6 +9058,11 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"

lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==

lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
Expand Down

0 comments on commit a3074f0

Please sign in to comment.