Skip to content

Commit d37f51f

Browse files
committed
feat(migrate): replace lodash.isequal
1 parent dba5b3f commit d37f51f

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

packages/sync-actions/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"fast-equals": "^2.0.0",
2727
"jsondiffpatch": "^0.4.0",
2828
"lodash.intersection": "^4.4.0",
29-
"lodash.isequal": "^4.5.0",
3029
"lodash.isnil": "^4.0.0",
3130
"lodash.shuffle": "^4.2.0",
3231
"lodash.sortby": "^4.7.0",

packages/sync-actions/src/types-actions.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import sortBy from 'lodash.sortby'
2-
3-
import isEqual from 'lodash.isequal'
42
import { buildBaseAttributesActions } from './utils/common-actions'
53
import createBuildArrayActions, {
64
ADD_ACTIONS,
75
CHANGE_ACTIONS,
86
} from './utils/create-build-array-actions'
97
import { getDeltaValue } from './utils/diffpatcher'
108
import extractMatchingPairs from './utils/extract-matching-pairs'
9+
import { deepEqual } from 'fast-equals'
1110

1211
const REGEX_NUMBER = new RegExp(/^\d+$/)
1312
const REGEX_UNDERSCORE_NUMBER = new RegExp(/^_\d+$/)
@@ -76,7 +75,7 @@ function actionsMapEnums(
7675
const foundPreviousEnum = previous.values.find(
7776
(previousEnum) => previousEnum.key === newEnum.key
7877
)
79-
const isLabelEqual = isEqual(foundPreviousEnum.label, newEnum.label)
78+
const isLabelEqual = deepEqual(foundPreviousEnum.label, newEnum.label)
8079

8180
if (isKeyChanged) {
8281
// these actions is then flatten in the end

packages/sync-actions/src/utils/create-build-actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import isEqual from 'lodash.isequal'
21
import isNil from 'lodash.isnil'
2+
import { deepEqual } from 'fast-equals'
33

44
function applyOnBeforeDiff(before, now, fn?: (before, now) => Array<any>) {
55
return fn && typeof fn === 'function' ? fn(before, now) : [before, now]
@@ -17,7 +17,7 @@ const createPriceComparator = (price) => ({
1717
function arePricesStructurallyEqual(oldPrice, newPrice) {
1818
const oldPriceComparison = createPriceComparator(oldPrice)
1919
const newPriceComparison = createPriceComparator(newPrice)
20-
return isEqual(newPriceComparison, oldPriceComparison)
20+
return deepEqual(newPriceComparison, oldPriceComparison)
2121
}
2222

2323
function extractPriceFromPreviousVariant(newPrice, previousVariant) {

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6881,11 +6881,6 @@ lodash.intersection@^4.4.0:
68816881
resolved "https://registry.yarnpkg.com/lodash.intersection/-/lodash.intersection-4.4.0.tgz#0a11ba631d0e95c23c7f2f4cbb9a692ed178e705"
68826882
integrity sha512-N+L0cCfnqMv6mxXtSPeKt+IavbOBBSiAEkKyLasZ8BVcP9YXQgxLO12oPR8OyURwKV8l5vJKiE1M8aS70heuMg==
68836883

6884-
lodash.isequal@^4.5.0:
6885-
version "4.5.0"
6886-
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
6887-
integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==
6888-
68896884
lodash.isfunction@^3.0.9:
68906885
version "3.0.9"
68916886
resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051"

0 commit comments

Comments
 (0)