Skip to content

Commit e2d2301

Browse files
committed
feat(sync-actions): improve naming
1 parent 2e7dbfe commit e2d2301

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ export const referenceActionsList = [
4848
* HELPER FUNCTIONS
4949
*/
5050

51-
const addAction = (key, resource) =>
51+
const getIsAddAction = (key, resource) =>
5252
REGEX_NUMBER.test(key) && Array.isArray(resource) && resource.length
5353

54-
const updateAction = (key, resource) =>
54+
const getIsUpdateAction = (key, resource) =>
5555
REGEX_NUMBER.test(key) && Object.keys(resource).length
5656

57-
const removeAction = (key, resource) =>
57+
const getIsRemoveAction = (key, resource) =>
5858
REGEX_UNDERSCORE_NUMBER.test(key) && Number(resource[2]) === 0
5959

6060
function _buildSkuActions(variantDiff, oldVariant) {
@@ -272,7 +272,7 @@ function _buildVariantPricesAction(
272272
oldVariant.prices,
273273
newVariant.prices
274274
)
275-
if (addAction(key, price)) {
275+
if (getIsAddAction(key, price)) {
276276
// Remove read-only fields
277277
const patchedPrice = price.map((p) => {
278278
const shallowClone = { ...p }
@@ -288,7 +288,7 @@ function _buildVariantPricesAction(
288288
return
289289
}
290290

291-
if (updateAction(key, price)) {
291+
if (getIsUpdateAction(key, price)) {
292292
// Remove the discounted field and make sure that the price
293293
// still has other values, otherwise simply return
294294
const filteredPrice = { ...price }
@@ -307,7 +307,7 @@ function _buildVariantPricesAction(
307307
return
308308
}
309309

310-
if (removeAction(key, price)) {
310+
if (getIsRemoveAction(key, price)) {
311311
// price removed
312312
removePriceActions.push({
313313
action: 'removePrice',
@@ -418,7 +418,7 @@ function _buildVariantAssetsActions(diffAssets, oldVariant, newVariant) {
418418
newVariant.assets
419419
)
420420

421-
if (addAction(key, asset)) {
421+
if (getIsAddAction(key, asset)) {
422422
assetActions.push({
423423
action: 'addAsset',
424424
asset: diffpatcher.getDeltaValue(asset),
@@ -428,7 +428,7 @@ function _buildVariantAssetsActions(diffAssets, oldVariant, newVariant) {
428428
return
429429
}
430430

431-
if (updateAction(key, asset)) {
431+
if (getIsUpdateAction(key, asset)) {
432432
// todo add changeAssetOrder
433433
const basicActions = buildBaseAttributesActions({
434434
actions: baseAssetActionsList,
@@ -468,7 +468,7 @@ function _buildVariantAssetsActions(diffAssets, oldVariant, newVariant) {
468468
return
469469
}
470470

471-
if (removeAction(key, asset)) {
471+
if (getIsRemoveAction(key, asset)) {
472472
assetActions.push({
473473
action: 'removeAsset',
474474
...toAssetIdentifier(oldAsset),

0 commit comments

Comments
 (0)