| 
									
										
										
										
											2020-07-08 16:23:09 +02:00
										 |  |  | exports.toSortedArray = function toSortedArray(challengeFiles) { | 
					
						
							| 
									
										
										
										
											2020-06-01 18:28:22 +02:00
										 |  |  |   const xs = Object.values(challengeFiles); | 
					
						
							|  |  |  |   // TODO: refactor this to use an ext array ['html', 'js', 'css'] and loop over
 | 
					
						
							|  |  |  |   // that.
 | 
					
						
							|  |  |  |   xs.sort((a, b) => { | 
					
						
							|  |  |  |     if (a.ext === 'html') return -1; | 
					
						
							|  |  |  |     if (b.ext === 'html') return 1; | 
					
						
							| 
									
										
										
										
											2020-06-03 15:24:02 +02:00
										 |  |  |     if (a.ext === 'jsx') return -1; | 
					
						
							|  |  |  |     if (b.ext === 'jsx') return 1; | 
					
						
							| 
									
										
										
										
											2020-06-01 18:28:22 +02:00
										 |  |  |     if (a.ext === 'js') return -1; | 
					
						
							|  |  |  |     if (b.ext === 'js') return 1; | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   return xs; | 
					
						
							| 
									
										
										
										
											2020-06-05 18:00:05 +02:00
										 |  |  | }; |