Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 20, 2022
1 parent 0150956 commit e3d7efd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/config/normalize/lib/wild_wild_utils/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { map } from './map.js'

// eslint-disable-next-line max-params
const pushUnshift = function (mapFunc, target, query, newValue, opts = {}) {
return map(target, query, mapFunc.bind(undefined, newValue), {
return map(target, query, (value) => mapFunc(value, newValue, opts), {
...opts,
entries: false,
})
}

const pushValue = function (newValue, value) {
const pushValue = function (value, newValue) {
return Array.isArray(value) ? [...value, ...newValue] : newValue
}

// Like `set()` but push an array of values to the target array instead
export const push = pushUnshift.bind(undefined, pushValue)

const unshiftValue = function (newValue, value) {
const unshiftValue = function (value, newValue) {
return Array.isArray(value) ? [...newValue, ...value] : newValue
}

Expand Down

0 comments on commit e3d7efd

Please sign in to comment.