:cogs: Nouvelle fonction publique

pull/386/head
Mael 2018-08-16 10:05:00 +02:00
parent d072ea0e3f
commit 42e1500bcf
1 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,17 @@
import { analyseMany } from './traverse.js'
// This file exports the functions of the public computing library
import { analyseMany, parseAll } from './traverse.js'
import { rulesFr, collectDefaults, nestedSituationToPathMap } from './rules'
export default analyseMany
let parsedRules = parseAll(rulesFr)
// The public evaluation function takes a nested object of input values
let nestedSituationToStateSelector = nestedSituation => dottedName =>
({
...collectDefaults(rulesFr),
...nestedSituationToPathMap(nestedSituation)
}[dottedName])
export default (targetNames, nestedSituation) =>
analyseMany(parsedRules, targetNames)(
nestedSituationToStateSelector(nestedSituation)
)