refactor run changes to build error object
This commit is contained in:
parent
4a76e08fad
commit
efae25583c
1 changed files with 9 additions and 3 deletions
|
@ -19,9 +19,15 @@ const PhonoChangeApplier = () => {
|
||||||
const runChanges = e => {
|
const runChanges = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// validate rules
|
// validate rules
|
||||||
console.log(epochs.forEach(epoch => {
|
let error = epochs.reduce((errorObject, epoch) => {
|
||||||
if (epoch.changes.find(change => !change.match(/>.*\/.*_/))) console.log({error: 'improper rule formatting'});
|
epoch.changes.map((change, index) => {
|
||||||
}))
|
if (!change.match(/>.*\/.*_/)) errorObject[epoch.name]
|
||||||
|
? errorObject[epoch.name].push(index)
|
||||||
|
: errorObject[epoch.name] = [index]
|
||||||
|
})
|
||||||
|
return errorObject;
|
||||||
|
}, {})
|
||||||
|
console.log(error)
|
||||||
// validate lexicon
|
// validate lexicon
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue