Skip to content

Commit

Permalink
refactor: use native findLast(Index) over lodash's
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Aug 8, 2024
1 parent 780165d commit 34a9d94
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
4 changes: 1 addition & 3 deletions adminSiteClient/GrapherConfigGridEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { match, P } from "ts-pattern"
//import * as lodash from "lodash"
import {
cloneDeep,
findLastIndex,
isArray,
isEmpty,
isEqual,
Expand Down Expand Up @@ -1447,8 +1446,7 @@ export class GrapherConfigGridEditor extends React.Component<GrapherConfigGridEd
(item) => item.key === itemKey
)
if (itemIndex !== -1) {
const lastVisibleIndex = findLastIndex(
columnSelection,
const lastVisibleIndex = columnSelection.findLastIndex(
(item) => item.visible
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
findGreatestCommonDivisorOfArray,
rollingMap,
omitUndefinedValues,
findLast,
} from "@ourworldindata/utils"
import { StackedPointPositionType, StackedSeries } from "./StackedConstants"

Expand Down Expand Up @@ -42,8 +41,8 @@ export const stackSeriesInBothDirections = <
.map((s) => s.points[pointIndex])
const pointBelowThisOne =
point.value < 0
? findLast(pointsBelowThisOne, (p) => p.value < 0)
: findLast(pointsBelowThisOne, (p) => p.value >= 0)
? pointsBelowThisOne.findLast((p) => p.value < 0)
: pointsBelowThisOne.findLast((p) => p.value >= 0)
point.valueOffset = pointBelowThisOne
? pointBelowThisOne.value + pointBelowThisOne.valueOffset
: 0
Expand Down
4 changes: 0 additions & 4 deletions packages/@ourworldindata/utils/src/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import {
dropWhile,
escapeRegExp,
extend,
findLast,
findLastIndex,
flatten,
get,
groupBy,
Expand Down Expand Up @@ -87,8 +85,6 @@ export {
dropWhile,
escapeRegExp,
extend,
findLast,
findLastIndex,
flatten,
get,
groupBy,
Expand Down
2 changes: 0 additions & 2 deletions packages/@ourworldindata/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ export {
dropRightWhile,
dropWhile,
extend,
findLast,
findLastIndex,
flatten,
get,
groupBy,
Expand Down

0 comments on commit 34a9d94

Please sign in to comment.