From f5b8eb07806f2f12365b3b00c559a0774a0ee22d Mon Sep 17 00:00:00 2001 From: cha0s Date: Mon, 22 Jun 2020 05:57:28 -0500 Subject: [PATCH] fix bye --- src/client/types/steps-lists.js | 64 --------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 src/client/types/steps-lists.js diff --git a/src/client/types/steps-lists.js b/src/client/types/steps-lists.js deleted file mode 100644 index 2013f68..0000000 --- a/src/client/types/steps-lists.js +++ /dev/null @@ -1,64 +0,0 @@ -import {flatten} from '@avocado/core'; -import {Context} from '@avocado/behavior'; -import {Traversal} from '@avocado/behavior/item/traversal'; - -import {typeFits} from './typing'; - -export const variableStepsList = ( - context, - previousSteps, - key, - variable, - variableType, - type, - isFinal, -) => { - const steps = []; - if (typeFits(type, variableType)) { - steps.push({type: 'key', key}); - } - const traversal = new Traversal({steps: previousSteps.concat(steps)}); - const description = Context.typeDescription( - variableType, - traversal.get(context), - ); - // TODO invoke can only work at the end of steps chain - if (typeFits(type, variableType)) { - if ('function' === typeof variable) { - steps.push({type: 'invoke', args: []}); - } - } - if (isFinal) { - return [steps]; - } - const sublists = Object.entries(description) - .map(([nextKey, newDescription]) => ( - variableStepsList( - context, - previousSteps.concat(steps), - nextKey, - ('object' === typeof variable && null !== variable) ? variable[nextKey] : undefined, - newDescription.type, - type, - newDescription.cycle, - ) - )) - .map((childLists) => ( - childLists.map((stepsList) => ( - stepsList.length > 0 - ? [{type: 'key', key}].concat(stepsList) - : [] - )) - )); - return sublists.length > 0 ? [steps].concat(flatten(sublists)) : [steps]; -}; - -export const contextStepsList = (context, type) => ( - flatten( - Object.entries(context.all()) - .map(([key, [variable, variableType]]) => ( - variableStepsList(context, [{type: 'key', key}], key, variable, variableType, type, false) - )), - ) - .filter((stepsList) => stepsList.length > 0) -);