| 
									
										
										
										
											2018-06-12 16:50:35 +01:00
										 |  |  | import { pick } from 'lodash'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-01 15:52:08 -07:00
										 |  |  | export function dashify(str) { | 
					
						
							|  |  |  |   return ('' + str) | 
					
						
							|  |  |  |     .toLowerCase() | 
					
						
							|  |  |  |     .replace(/\s/g, '-') | 
					
						
							| 
									
										
										
										
											2019-02-06 14:19:58 +00:00
										 |  |  |     .replace(/[^a-z0-9\-.]/gi, '') | 
					
						
							|  |  |  |     .replace(/:/g, ''); | 
					
						
							| 
									
										
										
										
											2016-01-04 14:26:07 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-03-26 14:20:54 -04:00
										 |  |  | // todo: unify with server/utils/index.js:dasherize
 | 
					
						
							|  |  |  | const dasherize = dashify; | 
					
						
							|  |  |  | export { dasherize }; | 
					
						
							| 
									
										
										
										
											2018-06-12 16:50:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-06 14:19:58 +00:00
										 |  |  | export const fixCompletedChallengeItem = obj => | 
					
						
							|  |  |  |   pick(obj, [ | 
					
						
							|  |  |  |     'id', | 
					
						
							|  |  |  |     'completedDate', | 
					
						
							|  |  |  |     'solution', | 
					
						
							|  |  |  |     'githubLink', | 
					
						
							|  |  |  |     'challengeType', | 
					
						
							| 
									
										
										
										
											2019-02-16 00:31:05 +00:00
										 |  |  |     'files' | 
					
						
							| 
									
										
										
										
											2019-02-06 14:19:58 +00:00
										 |  |  |   ]); |