Skip to content

Commit 9417b14

Browse files
committed
feat(migrate): replace lodash.intersection
1 parent 4c4e4ea commit 9417b14

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

packages/sync-actions/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"dependencies": {
2626
"fast-equals": "^2.0.0",
2727
"jsondiffpatch": "^0.4.0",
28-
"lodash.intersection": "^4.4.0",
2928
"lodash.shuffle": "^4.2.0",
3029
"lodash.sortby": "^4.7.0",
3130
"lodash.uniqwith": "^4.5.0"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/* eslint-disable max-len */
21
import { ProductVariant } from '@commercetools/platform-sdk/src'
3-
import intersection from 'lodash.intersection'
42
import uniqWith from 'lodash.uniqwith'
53
import actionsMapCustom from './utils/action-map-custom'
64
import {
@@ -423,7 +421,9 @@ function _buildVariantChangeAssetOrderAction(
423421
const assetIdsCurrent = newVariant.assets
424422
.map((_) => _.id)
425423
.filter((_) => _ !== undefined)
426-
const assetIdsToKeep = intersection(assetIdsCurrent, assetIdsBefore)
424+
const assetIdsToKeep = assetIdsCurrent.filter((value) =>
425+
assetIdsBefore.includes(value)
426+
)
427427
const assetIdsToRemove = assetIdsBefore.filter(
428428
(item) => !assetIdsToKeep.includes(item)
429429
)

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6876,11 +6876,6 @@ lodash.debounce@^4.0.8:
68766876
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
68776877
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==
68786878

6879-
lodash.intersection@^4.4.0:
6880-
version "4.4.0"
6881-
resolved "https://registry.yarnpkg.com/lodash.intersection/-/lodash.intersection-4.4.0.tgz#0a11ba631d0e95c23c7f2f4cbb9a692ed178e705"
6882-
integrity sha512-N+L0cCfnqMv6mxXtSPeKt+IavbOBBSiAEkKyLasZ8BVcP9YXQgxLO12oPR8OyURwKV8l5vJKiE1M8aS70heuMg==
6883-
68846879
lodash.isfunction@^3.0.9:
68856880
version "3.0.9"
68866881
resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051"

0 commit comments

Comments
 (0)