mirror of
				https://github.com/Mibew/mibew.git
				synced 2025-11-04 12:25:11 +03:00 
			
		
		
		
	Improve Mibew.Utils.toDashFormat JS function
This commit is contained in:
		
							parent
							
								
									e273b04dab
								
							
						
					
					
						commit
						6d3810b7ba
					
				@ -49,10 +49,17 @@
 | 
				
			|||||||
        if (typeof str != 'string') {
 | 
					        if (typeof str != 'string') {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        var parts = str.match(/((?:[A-Z]?[a-z]+)|(?:[A-Z][a-z]*))/g);
 | 
					
 | 
				
			||||||
 | 
					        var parts = str.match(/((?:[A-Z]?[a-z0-9]+)|(?:[A-Z][a-z0-9]*))/g);
 | 
				
			||||||
 | 
					        if (!parts) {
 | 
				
			||||||
 | 
					            // It seems that the sting has no convertible parts.
 | 
				
			||||||
 | 
					            return '';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for(var i = 0; i < parts.length; i++) {
 | 
					        for(var i = 0; i < parts.length; i++) {
 | 
				
			||||||
            parts[i] = parts[i].toLowerCase();
 | 
					            parts[i] = parts[i].toLowerCase();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return parts.join('-');
 | 
					        return parts.join('-');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user