You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							13 lines
						
					
					
						
							372 B
						
					
					
				
			
		
		
	
	
							13 lines
						
					
					
						
							372 B
						
					
					
				module.exports = function cmp (a, b) { | 
						|
    var pa = a.split('.'); | 
						|
    var pb = b.split('.'); | 
						|
    for (var i = 0; i < 3; i++) { | 
						|
        var na = Number(pa[i]); | 
						|
        var nb = Number(pb[i]); | 
						|
        if (na > nb) return 1; | 
						|
        if (nb > na) return -1; | 
						|
        if (!isNaN(na) && isNaN(nb)) return 1; | 
						|
        if (isNaN(na) && !isNaN(nb)) return -1; | 
						|
    } | 
						|
    return 0; | 
						|
};
 | 
						|
 |