Skip to content

Commit

Permalink
Improve definition value
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 29, 2022
1 parent d44654a commit c443f3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/config/normalize/lib/call/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ export const callNormalize = async function ({
// Other exceptions are considered keyword bugs.
export const callMain = async function ({
main,
normalizedDefinition,
definition,
input,
info,
hasInput,
test,
keyword,
}) {
const func = main.bind(undefined, definition)
const func = main.bind(undefined, normalizedDefinition)
return await callFunc({
func,
input,
Expand Down
5 changes: 3 additions & 2 deletions src/config/normalize/lib/keywords/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const applyKeyword = async function ({
return state
}

const definitionB = await normalizeDefinition({
const normalizedDefinition = await normalizeDefinition({
definition: definitionA,
normalize,
info,
Expand All @@ -132,7 +132,8 @@ const applyKeyword = async function ({
})
const returnValue = await callMain({
main,
definition: definitionB,
normalizedDefinition,
definition: definitionA,
input,
info,
hasInput,
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/keywords/skip.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const shouldSkipKeyword = async function ({
// - This is because some keywords might only apply when the input has a
// specific value (e.g. `undefined` for `required|default` keywords), i.e.
// need to check the input during `test()` but should not pass it during
// `main()` nor the definition function
// `main()` not the definition function
const hasSkippedTest = async function ({ test, input, info, keyword }) {
return test !== undefined && !(await callTest({ test, input, info, keyword }))
}
Expand Down

0 comments on commit c443f3b

Please sign in to comment.