Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jan 2, 2022
1 parent c2226bd commit 3717a71
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/history/data/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import inquirer from 'inquirer'
import sortOn from 'sort-on'

import { isTtyInput } from '../../report/tty.js'
import { validateMatches } from '../../select/validate.js'
import { pickLast } from '../../utils/last.js'
import { applyMainDelta, applySinceDelta } from '../delta/find.js'
import { compressRawResult } from '../normalize/compress.js'
Expand Down Expand Up @@ -61,7 +60,6 @@ export const getFromHistory = async function (config) {
historyA,
config,
)
validateMatches(rawResult, config)
return { rawResult, history: historyB }
}

Expand Down
12 changes: 5 additions & 7 deletions src/history/normalize/load.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { keepResultCombinations } from '../../combination/result.js'
import { selectRawResult } from '../../select/main.js'
import { validateMatches } from '../../select/validate.js'

import { decompressRawResult } from './compress.js'
import { migrateRawResults } from './migrate.js'
Expand All @@ -13,15 +14,12 @@ export const loadRawResults = function (rawResults) {

// Normalize the history and target results after load, once the target result
// is known
export const normalizeRawResults = function (
targetResult,
history,
{ select },
) {
export const normalizeRawResults = function (targetResult, history, config) {
const historyA = filterUnusedCombinations(history, targetResult)
const [targetResultA, ...historyB] = [targetResult, ...historyA].map(
(rawResult) => normalizeRawResult(rawResult, select),
(rawResult) => normalizeRawResult(rawResult, config),
)
validateMatches(targetResultA, config)
return { targetResult: targetResultA, history: historyB }
}

Expand All @@ -34,6 +32,6 @@ const filterUnusedCombinations = function (history, targetResult) {
)
}

const normalizeRawResult = function (rawResult, select) {
const normalizeRawResult = function (rawResult, { select }) {
return selectRawResult(rawResult, select)
}
2 changes: 0 additions & 2 deletions src/run/create.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { listCombinations } from '../combination/list.js'
import { listHistory } from '../history/data/main.js'
import { normalizeRawResults } from '../history/normalize/load.js'
import { validateMatches } from '../select/validate.js'
import { createSystemInfo } from '../system/create.js'
import { addSystemVersions } from '../system/versions.js'

Expand All @@ -16,7 +15,6 @@ export const createResult = async function (config) {
history,
config,
)
validateMatches(rawResultA, config)
const rawResultB = await addSystemVersions(rawResultA, config)
return { rawResult: rawResultB, history: historyA }
}
Expand Down

0 comments on commit 3717a71

Please sign in to comment.