mirror of
				https://github.com/Mibew/simple-icons.git
				synced 2025-10-31 10:31:06 +03:00 
			
		
		
		
	Require Sorting by Slug (#5115)
# Fix indentation of format function. # Co-authored-by: Eric Cornelissen <ericornelissen@gmail.com> # Update formatting in scripts/lint.js # Co-authored-by: Eric Cornelissen <ericornelissen@gmail.com> # Fix Handshake order # Require Sorting by Slug
This commit is contained in:
		
							parent
							
								
									cbe05f9bbe
								
							
						
					
					
						commit
						6c435fe741
					
				| @ -3651,14 +3651,14 @@ | ||||
|         }, | ||||
|         { | ||||
|             "title": "Handshake", | ||||
|             "slug": "handshake_protocol", | ||||
|             "hex": "000000", | ||||
|             "source": "https://handshake.org/" | ||||
|             "hex": "FF2F1C", | ||||
|             "source": "https://learn.joinhandshake.com/marketing-toolkit/" | ||||
|         }, | ||||
|         { | ||||
|             "title": "Handshake", | ||||
|             "hex": "FF2F1C", | ||||
|             "source": "https://learn.joinhandshake.com/marketing-toolkit/" | ||||
|             "slug": "handshake_protocol", | ||||
|             "hex": "000000", | ||||
|             "source": "https://handshake.org/" | ||||
|         }, | ||||
|         { | ||||
|             "title": "HappyCow", | ||||
|  | ||||
| @ -25,17 +25,30 @@ const TESTS = { | ||||
|     const collector = (invalidEntries, icon, index, array) => { | ||||
|       if (index > 0) { | ||||
|         const prev = array[index - 1]; | ||||
|         if (icon.title.localeCompare(prev.title) < 0) { | ||||
|         const compare = icon.title.localeCompare(prev.title); | ||||
|         if (compare < 0) { | ||||
|           invalidEntries.push(icon); | ||||
|         } else if (compare === 0) { | ||||
|           if (prev.slug) { | ||||
|             if (!icon.slug || icon.slug.localeCompare(prev.slug) < 0) { | ||||
|               invalidEntries.push(icon); | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       return invalidEntries; | ||||
|     }; | ||||
|     const format = icon => { | ||||
|       if (icon.slug) { | ||||
|         return `${icon.title} (${icon.slug})`; | ||||
|       } | ||||
|       return icon.title; | ||||
|     }; | ||||
| 
 | ||||
|     const invalids = data.icons.reduce(collector, []); | ||||
|     if (invalids.length) { | ||||
|       return `Some icons aren't in alphabetical order:
 | ||||
|         ${invalids.map(icon => icon.title).join(", ")}`;
 | ||||
|         ${invalids.map(icon => format(icon)).join(", ")}`;
 | ||||
|     } | ||||
|   }, | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user