1- window . createToDoJuicer = ( state ) => {
2- const juicer = new window . Juicer ( { initialState :state , dev :true } )
1+ window . createToDoJuicr = ( state ) => {
2+ const juicr = new window . Juicr ( { initialState :state , dev :true } )
33
44let id = 0
55
@@ -8,7 +8,7 @@ window.createToDoJuicer = (state) => {
88return todos [ i ]
99}
1010
11- juicer . action ( 'addTodo' , ( { } , _state ) => {
11+ juicr . action ( 'addTodo' , ( { } , _state ) => {
1212if ( _state . newTodo . length === 0 ) {
1313return { errorText :"cannot create empty todo" }
1414} else {
@@ -25,15 +25,15 @@ window.createToDoJuicer = (state) => {
2525}
2626} )
2727
28- juicer . action ( 'textInput' , ( { text} , _state ) => {
28+ juicr . action ( 'textInput' , ( { text} , _state ) => {
2929return { newTodo :text }
3030} )
3131
32- juicer . action ( 'setFilter' , ( { filter} , _state ) => {
32+ juicr . action ( 'setFilter' , ( { filter} , _state ) => {
3333return { filter}
3434} )
3535
36- juicer . action ( 'toggleAll' , ( { } , _state ) => {
36+ juicr . action ( 'toggleAll' , ( { } , _state ) => {
3737return {
3838todos :_state . todos . map ( ( t ) => {
3939t . isComplete = true
@@ -42,7 +42,7 @@ window.createToDoJuicer = (state) => {
4242}
4343} )
4444
45- juicer . action ( 'toggleDone' , ( { id} , _state ) => {
45+ juicr . action ( 'toggleDone' , ( { id} , _state ) => {
4646const todo = findToDoFromId ( _state . todos , id )
4747if ( todo ) {
4848todo . isComplete = ! todo . isComplete
@@ -52,7 +52,7 @@ window.createToDoJuicer = (state) => {
5252}
5353} )
5454
55- juicer . action ( 'toggleEdit' , ( { id} , _state ) => {
55+ juicr . action ( 'toggleEdit' , ( { id} , _state ) => {
5656const todo = findToDoFromId ( _state . todos , id )
5757if ( todo ) {
5858todo . isEditing = ! todo . isEditing
@@ -62,7 +62,7 @@ window.createToDoJuicer = (state) => {
6262}
6363} )
6464
65- juicer . action ( 'updateTodo' , ( { id, title} , _state ) => {
65+ juicr . action ( 'updateTodo' , ( { id, title} , _state ) => {
6666const todo = findToDoFromId ( _state . todos , id )
6767if ( todo ) {
6868todo . title = title
@@ -72,15 +72,15 @@ window.createToDoJuicer = (state) => {
7272}
7373} )
7474
75- juicer . action ( 'clearCompleted' , ( { } , _state ) => {
75+ juicr . action ( 'clearCompleted' , ( { } , _state ) => {
7676return { todos :_state . todos . filter ( t => t . isComplete === false ) }
7777} )
7878
79- juicer . action ( 'delete' , ( { id} , _state ) => {
79+ juicr . action ( 'delete' , ( { id} , _state ) => {
8080return { todos :_state . todos . filter ( t => t . id !== id ) }
8181} )
8282
83- juicer . reaction ( [ "todos" , "filter" ] , ( changedState , _state ) => {
83+ juicr . reaction ( [ "todos" , "filter" ] , ( changedState , _state ) => {
8484const filters = {
8585all :( t ) => { return t } ,
8686completed :( t ) => { return t . isComplete === true } ,
@@ -93,5 +93,5 @@ window.createToDoJuicer = (state) => {
9393}
9494} )
9595
96- return juicer
96+ return juicr
9797}