diff --git a/votes/package.json b/votes/package.json index a7e5b92..61dc367 100644 --- a/votes/package.json +++ b/votes/package.json @@ -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" diff --git a/votes/src/classes/method.ts b/votes/src/classes/method.ts index e0ed4f9..e895d14 100644 --- a/votes/src/classes/method.ts +++ b/votes/src/classes/method.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { scoresToRanking } from '../utils/scores' diff --git a/votes/src/classes/random-matrix-method.ts b/votes/src/classes/random-matrix-method.ts index f8976cc..e5f62d3 100644 --- a/votes/src/classes/random-matrix-method.ts +++ b/votes/src/classes/random-matrix-method.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import type { Matrix, ScoreObject } from '../types' import { shuffleArray } from '../utils/shuffle-array' diff --git a/votes/src/methods/baldwin/index.ts b/votes/src/methods/baldwin/index.ts index cd036ca..fa5c7f3 100644 --- a/votes/src/methods/baldwin/index.ts +++ b/votes/src/methods/baldwin/index.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { RoundBallotMethod } from '../../classes/round-ballot-method' import type { Ballot, ScoreObject } from '../../types' diff --git a/votes/src/methods/biggest-support/index.ts b/votes/src/methods/biggest-support/index.ts index de80b9c..085bc34 100644 --- a/votes/src/methods/biggest-support/index.ts +++ b/votes/src/methods/biggest-support/index.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { BallotMethod } from '../../classes/ballot-method' import type { Ballot } from '../../types' diff --git a/votes/src/methods/bottom-two-runoff/index.ts b/votes/src/methods/bottom-two-runoff/index.ts index b097aaa..2d031eb 100644 --- a/votes/src/methods/bottom-two-runoff/index.ts +++ b/votes/src/methods/bottom-two-runoff/index.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { RoundBallotMethod } from '../../classes/round-ballot-method' import type { Ballot, ScoreObject } from '../../types' diff --git a/votes/src/methods/coombs/index.ts b/votes/src/methods/coombs/index.ts index 291dacb..5fcdd90 100644 --- a/votes/src/methods/coombs/index.ts +++ b/votes/src/methods/coombs/index.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { RoundBallotMethod } from '../../classes/round-ballot-method' import type { Ballot, ScoreObject } from '../../types' diff --git a/votes/src/methods/copeland/index.ts b/votes/src/methods/copeland/index.ts index be973ec..351d1fd 100644 --- a/votes/src/methods/copeland/index.ts +++ b/votes/src/methods/copeland/index.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { MatrixScoreMethod } from '../../classes/matrix-score-method' import type { Matrix, ScoreObject } from '../../types' diff --git a/votes/src/methods/kemeny/index.ts b/votes/src/methods/kemeny/index.ts index 6223fb6..9c4eea1 100644 --- a/votes/src/methods/kemeny/index.ts +++ b/votes/src/methods/kemeny/index.ts @@ -1,5 +1,5 @@ -import range from 'lodash/range' -import zipObject from 'lodash/zipObject' +import range from 'lodash-es/range' +import zipObject from 'lodash-es/zipObject' import { MatrixScoreMethod } from '../../classes/matrix-score-method' import type { Matrix, ScoreObject } from '../../types' diff --git a/votes/src/methods/majority-judgment/index.ts b/votes/src/methods/majority-judgment/index.ts index e92b127..306ea6a 100644 --- a/votes/src/methods/majority-judgment/index.ts +++ b/votes/src/methods/majority-judgment/index.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { BallotMethod } from '../../classes/ballot-method' import type { Ballot, ScoreObject } from '../../types' diff --git a/votes/src/methods/maximal-lotteries/index.ts b/votes/src/methods/maximal-lotteries/index.ts index abd35b0..805dabf 100644 --- a/votes/src/methods/maximal-lotteries/index.ts +++ b/votes/src/methods/maximal-lotteries/index.ts @@ -1,4 +1,4 @@ -import zipObject from 'lodash/zipObject' +import zipObject from 'lodash-es/zipObject' import { RandomMatrixMethod } from '../../classes/random-matrix-method' import { findNashEquilibrium } from '../../simplex/find-nash-equilibrium' diff --git a/votes/src/methods/minimax-td/index.ts b/votes/src/methods/minimax-td/index.ts index abd4a99..7ce1ca1 100644 --- a/votes/src/methods/minimax-td/index.ts +++ b/votes/src/methods/minimax-td/index.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import type { Matrix, ScoreObject } from '../../types' import { findSmithSet } from '../../utils/condorcet' diff --git a/votes/src/methods/nanson/index.ts b/votes/src/methods/nanson/index.ts index 4de7972..4f292f1 100644 --- a/votes/src/methods/nanson/index.ts +++ b/votes/src/methods/nanson/index.ts @@ -1,5 +1,5 @@ -import _ from 'lodash' -import sum from 'lodash/sum' +import _ from 'lodash-es' +import sum from 'lodash-es/sum' import { RoundBallotMethod } from '../../classes/round-ballot-method' import type { Ballot, ScoreObject } from '../../types' diff --git a/votes/src/methods/random-candidates/index.ts b/votes/src/methods/random-candidates/index.ts index 42eb025..e5f982f 100644 --- a/votes/src/methods/random-candidates/index.ts +++ b/votes/src/methods/random-candidates/index.ts @@ -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' diff --git a/votes/src/methods/ranked-pairs/generate-acyclic-graph.ts b/votes/src/methods/ranked-pairs/generate-acyclic-graph.ts index a405301..ce3f811 100644 --- a/votes/src/methods/ranked-pairs/generate-acyclic-graph.ts +++ b/votes/src/methods/ranked-pairs/generate-acyclic-graph.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { Tarjan } from './tarjan' import { Vertex } from './vertex' diff --git a/votes/src/methods/ranked-pairs/index.ts b/votes/src/methods/ranked-pairs/index.ts index 8ce391e..d879a1f 100644 --- a/votes/src/methods/ranked-pairs/index.ts +++ b/votes/src/methods/ranked-pairs/index.ts @@ -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' +import range from 'lodash-es/range' +import zipObject from 'lodash-es/zipObject' import { MatrixScoreMethod } from '../../classes/matrix-score-method' import type { Matrix, ScoreObject } from '../../types' diff --git a/votes/src/methods/schulze/index.ts b/votes/src/methods/schulze/index.ts index 1cb4445..2ac2159 100644 --- a/votes/src/methods/schulze/index.ts +++ b/votes/src/methods/schulze/index.ts @@ -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' diff --git a/votes/src/methods/two-round-runoff/index.ts b/votes/src/methods/two-round-runoff/index.ts index e0e6750..8b52f54 100644 --- a/votes/src/methods/two-round-runoff/index.ts +++ b/votes/src/methods/two-round-runoff/index.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import { RoundBallotMethod } from '../../classes/round-ballot-method' import type { ScoreObject } from '../../types' diff --git a/votes/src/test/matrix.ts b/votes/src/test/matrix.ts index c51ac26..220953a 100644 --- a/votes/src/test/matrix.ts +++ b/votes/src/test/matrix.ts @@ -1,4 +1,4 @@ -import range from 'lodash/range' +import range from 'lodash-es/range' export const product = (a: number[][], b: number[][]): number[][] => { const dimA = [a.length, a[0].length] diff --git a/votes/src/test/test-utils.ts b/votes/src/test/test-utils.ts index 514cebf..6c6ce47 100644 --- a/votes/src/test/test-utils.ts +++ b/votes/src/test/test-utils.ts @@ -1,4 +1,4 @@ -import fill from 'lodash/fill' +import fill from 'lodash-es/fill' import type { Ballot } from '../types' import { toWeightedBallots } from '../utils' diff --git a/votes/src/utils/condorcet.ts b/votes/src/utils/condorcet.ts index 9a857c4..1de81a0 100644 --- a/votes/src/utils/condorcet.ts +++ b/votes/src/utils/condorcet.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import type { Matrix } from '../types' diff --git a/votes/src/utils/make-matrix.ts b/votes/src/utils/make-matrix.ts index 506fe16..b446dae 100644 --- a/votes/src/utils/make-matrix.ts +++ b/votes/src/utils/make-matrix.ts @@ -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' +import range from 'lodash-es/range' +import times from 'lodash-es/times' import type { Ballot, Matrix } from '../types' diff --git a/votes/src/utils/normalize.ts b/votes/src/utils/normalize.ts index 8f1f435..c19cc28 100644 --- a/votes/src/utils/normalize.ts +++ b/votes/src/utils/normalize.ts @@ -1,4 +1,4 @@ -import _ from 'lodash' +import _ from 'lodash-es' import type { Ballot } from '../types' diff --git a/votes/src/utils/scores-zero.ts b/votes/src/utils/scores-zero.ts index 49928db..a3c133a 100644 --- a/votes/src/utils/scores-zero.ts +++ b/votes/src/utils/scores-zero.ts @@ -1,4 +1,4 @@ -import zipObject from 'lodash/zipObject' +import zipObject from 'lodash-es/zipObject' import type { ScoreObject } from '../types' diff --git a/votes/src/utils/scores.ts b/votes/src/utils/scores.ts index 5298d61..5d9b2f7 100644 --- a/votes/src/utils/scores.ts +++ b/votes/src/utils/scores.ts @@ -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' +import sortBy from 'lodash-es/sortBy' +import toPairs from 'lodash-es/toPairs' export const scoresToRanking = (scores: { [candidate: string]: number diff --git a/yarn.lock b/yarn.lock index 1a7f266..e965bdb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"