Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jan 9, 2022
1 parent 413742c commit f518318
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/combination/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { removePrefix } from './prefix.js'
// - Selectable with `select`
export const addDefaultIds = function (history, targetResult) {
const defaultDimensions = getDefaultDimensions(targetResult)
return history.map((rawResult) =>
addRawResultDefaultIds(rawResult, defaultDimensions),
return history.map((historyResult) =>
addResultDefaultIds(historyResult, defaultDimensions),
)
}

Expand All @@ -46,12 +46,12 @@ const getDefaultDimension = function (dimension) {
return [dimension.propName, { id }]
}

const addRawResultDefaultIds = function (rawResult, defaultDimensions) {
const combinations = rawResult.combinations.map((combination) => ({
const addResultDefaultIds = function (result, defaultDimensions) {
const combinations = result.combinations.map((combination) => ({
...combination,
dimensions: { ...defaultDimensions, ...combination.dimensions },
}))
return { ...rawResult, combinations }
return { ...result, combinations }
}

// Find whether an id matches the default id pattern of a dimension.
Expand Down
8 changes: 4 additions & 4 deletions src/combination/result.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getCombinationIds } from './ids/get.js'

// Filter out the `combinations` that are not in `result`
export const keepResultCombinations = function (rawResult, result) {
const combinations = rawResult.combinations.filter((combination) =>
resultHasCombination(result, combination),
export const keepResultCombinations = function (resultA, resultB) {
const combinations = resultA.combinations.filter((combination) =>
resultHasCombination(resultB, combination),
)
return { ...rawResult, combinations }
return { ...resultA, combinations }
}

// Filter out the `combinations` that are in `result`
Expand Down
8 changes: 4 additions & 4 deletions src/report/normalize/raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { addDefaultIds } from '../../combination/default.js'
import { getNoDimensions } from '../../combination/filter.js'
import { keepResultCombinations } from '../../combination/result.js'
import { mergeResults } from '../../history/merge/results.js'
import { selectRawResult } from '../../select/main.js'
import { selectResult } from '../../select/main.js'

// Transform:
// - A `rawResult`: persisted in result files
Expand Down Expand Up @@ -35,7 +35,7 @@ export const normalizeReportedResults = function (
history,
targetResult,
)
const targetResultB = selectRawResult(targetResultA, select)
const targetResultB = selectResult(targetResultA, select)
const historyB = addDefaultIds(historyA, targetResultB)
const historyC = filterUnusedCombinations(historyB, targetResultB)
const noDimensions = getNoDimensions(targetResultB.combinations)
Expand All @@ -46,7 +46,7 @@ export const normalizeReportedResults = function (
// target result.
// This simplifies both the implementation and the user experience.
const filterUnusedCombinations = function (history, targetResult) {
return history.map((rawResult) =>
keepResultCombinations(rawResult, targetResult),
return history.map((historyResult) =>
keepResultCombinations(historyResult, targetResult),
)
}
6 changes: 3 additions & 3 deletions src/select/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import { validateSelectMatches } from './validate.js'
// - Changing `select` does not change the history start|end, which is less
// confusing
// - This does not require loading files before resolving deltas
export const selectRawResult = function (rawResult, select) {
const combinations = selectCombinations(rawResult.combinations, select)
return { ...rawResult, combinations }
export const selectResult = function (result, select) {
const combinations = selectCombinations(result.combinations, select)
return { ...result, combinations }
}

export const selectCombinations = function (combinations, select) {
Expand Down

0 comments on commit f518318

Please sign in to comment.