@@ -80,14 +80,25 @@ const getSchedule = _getSchedule => id =>
80
80
* @param {[string / array of strings] } id [name of a thing]
81
81
* @return {[promise] } [todays schedule]
82
82
*/
83
- const getTodaysSchedule = _getSchedule => id =>
83
+ const getScheduleByDate = _getSchedule => ( id , date = new Date ( ) ) =>
84
84
new Promise ( ( resolve , reject ) => {
85
85
_getSchedule ( id )
86
86
. then ( data => JSON . parse ( data ) )
87
- . then ( parsedData => resolve ( dataParser . buildTodaysSchedule ( parsedData , id ) ) )
87
+ . then ( parsedData => resolve ( dataParser . buildScheduleByDate ( parsedData , id , date ) ) )
88
88
. catch ( reject ) ;
89
89
} ) ;
90
90
91
+
92
+ /**
93
+ * [gets todays schedule]
94
+ * @param {[object] } _getSchedule [initilized _getSchedule object]
95
+ * @param {[string / array of strings] } id [name of a thing]
96
+ * @return {[promise] } [todays schedule]
97
+ */
98
+ const getTodaysSchedule = _getSchedule => id =>
99
+ getScheduleByDate ( _getSchedule ) ( id ) ;
100
+
101
+
91
102
/**
92
103
* [gets schedule for multible days un parsed]
93
104
* @param {[object] } scraper [initilized scraper object]
@@ -116,6 +127,7 @@ const api = (url, types) => {
116
127
117
128
return {
118
129
getSchedule : getSchedule ( _getSchedule ( scraper ) ) ,
130
+ getScheduleByDate : getScheduleByDate ( _getSchedule ( scraper ) ) ,
119
131
getTodaysSchedule : getTodaysSchedule ( _getSchedule ( scraper ) ) ,
120
132
search : search ( scraper ) ,
121
133
getScheduleByItemId : getScheduleByItemId ( scraper ) ,
0 commit comments