11import { trimQuotes , trimLeadingSpaces } from './cleanup' ;
22import * as Match from './match' ;
3- import { brackets } from './brackets' ;
43
54export function trimCommandValue ( text : string ) : string {
65 let value = text . substring ( text . indexOf ( '(' ) + 1 ) . slice ( 0 , - 1 ) ;
@@ -11,7 +10,7 @@ export function trimCommandValue(text: string): string {
1110 return command . action + '(\'' + command . value + '\')' ;
1211}
1312
14- function doAction ( type : 'test ' | 'hint ' , isArray , actionValue , result , line , index ) {
13+ function doAction ( type : 'tests ' | 'hints ' , isArray , actionValue , result , line , index ) {
1514 // set to array
1615 if ( result . chapters [ index . chapter ] . pages [ index . page ] . tasks [ index . task ] [ type ] === undefined ) {
1716 result . chapters [ index . chapter ] . pages [ index . page ] . tasks [ index . task ] [ type ] = [ ] ;
@@ -28,7 +27,7 @@ function doAction(type: 'test' | 'hint', isArray, actionValue, result, line, ind
2827 return result ;
2928}
3029
31- export function addToTasks ( result , line , index ) : result {
30+ export function addToTasks ( result , line , index ) {
3231 let match = Match . isAction ( line ) ;
3332 let action = match . action ; // action|test|hint|answer
3433 let task = result . chapters [ index . chapter ] . pages [ index . page ] . tasks [ index . task ] ;
@@ -49,7 +48,7 @@ export function addToTasks(result, line, index): result {
4948 if ( ! ! isActionArray ) {
5049 var arrayOfActions = JSON . parse ( isActionArray ) ;
5150 arrayOfActions . forEach ( function ( value ) {
52- let value = trimCommandValue ( trimQuotes ( value . trim ( ) ) ) ;
51+ value = trimCommandValue ( trimQuotes ( value . trim ( ) ) ) ;
5352 result . chapters [ index . chapter ] . pages [ index . page ] . tasks [ index . task ] . actions . push ( value ) ;
5453 } ) ;
5554 }
@@ -58,7 +57,6 @@ export function addToTasks(result, line, index): result {
5857 result . chapters [ index . chapter ] . pages [ index . page ] . tasks [ index . task ] . actions . push ( value ) ;
5958 }
6059 return result ;
61- break ;
6260
6361 default :
6462 console . log ( 'Invalid task action' ) ;
0 commit comments