File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
application-infrastructure/src/views Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 33*/
44
55const { tools : { Timer} } = require ( "@63klabs/cache-data" ) ;
6+ const { DebugAndLog } = require ( "@63klabs/cache-data/src/lib/tools" ) ;
67
78const logIdentifier = "Example View" ;
89
910/**
10- * Generic filter
11+ * Generic filter to exclude null values
1112 * @param {object } data
1213 * @returns {boolean } exclude
1314 */
@@ -37,14 +38,15 @@ const transform = (data) => {
3738
3839/**
3940 * Generic view
40- * @param {object } data
41+ * @param {object } resultsFromSvc
4142 * @returns {{count: number, items: Array<{id: number, display: string}>} } data
4243 */
43- exports . view = ( data ) => {
44+ exports . view = ( resultsFromSvc ) => {
4445 const viewTimer = new Timer ( `Timer: ${ logIdentifier } ` , true ) ;
46+ DebugAndLog . debug ( `View: ${ logIdentifier } ` , data ) ;
4547
4648 // if data then data else empty array
47- const dataArray = data || [ ] ;
49+ const dataArray = Array . isArray ( resultsFromSvc ?. gamechoices ) ? resultsFromSvc ?. gamechoices : [ ] ;
4850
4951 // The filter and transform functions can be customized or replaced as needed
5052 // They can also be combined so that the filter and transform are done in one pass
You can’t perform that action at this time.
0 commit comments