Skip to content

Commit 81b18d7

Browse files
committed
feat(migrate): replace lodash.uniqwith
1 parent 8d67ee2 commit 81b18d7

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

packages/sync-actions/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
"dependencies": {
2626
"fast-equals": "^2.0.0",
2727
"jsondiffpatch": "^0.4.0",
28-
"lodash.sortby": "^4.7.0",
29-
"lodash.uniqwith": "^4.5.0"
28+
"lodash.sortby": "^4.7.0"
3029
},
3130
"files": ["dist", "CHANGELOG.md"],
3231
"author": "Nicola Molinari <nicola.molinari@commercetools.com> (https://github.com/emmenko)",

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ProductVariant } from '@commercetools/platform-sdk/src'
2-
import uniqWith from 'lodash.uniqwith'
32
import actionsMapCustom from './utils/action-map-custom'
43
import {
54
buildBaseAttributesActions,
@@ -701,10 +700,15 @@ export function actionsMapAttributes(
701700

702701
// Ensure that an action is unique.
703702
// This is especially necessary for SFA attributes.
704-
return uniqWith(
705-
actions,
706-
(a, b) =>
707-
a.action === b.action && a.name === b.name && a.variantId === b.variantId
703+
return actions.filter(
704+
(b, index, self) =>
705+
index ===
706+
self.findIndex(
707+
(a) =>
708+
a.action === b.action &&
709+
a.name === b.name &&
710+
a.variantId === b.variantId
711+
)
708712
)
709713
}
710714

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6926,11 +6926,6 @@ lodash.uniq@^4.5.0:
69266926
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
69276927
integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==
69286928

6929-
lodash.uniqwith@^4.5.0:
6930-
version "4.5.0"
6931-
resolved "https://registry.yarnpkg.com/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz#7a0cbf65f43b5928625a9d4d0dc54b18cadc7ef3"
6932-
integrity sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==
6933-
69346929
lodash.upperfirst@^4.3.1:
69356930
version "4.3.1"
69366931
resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"

0 commit comments

Comments
 (0)