]> git.ardis.lu - ens2hex/commitdiff
Lowercase all names per UTS46
authorArdis Lu <ardisglu@gmail.com>
Fri, 26 May 2023 04:56:06 +0000 (21:56 -0700)
committerArdis Lu <ardisglu@gmail.com>
Fri, 26 May 2023 04:56:06 +0000 (21:56 -0700)
The normalization is not fully compliant but still works for most names

index.html

index 800dfa6a4c612c92af9100fd65085d2e16c88ec1..0119ac27b19b94a299612ec4fdc9c7beba5f47da 100644 (file)
 
       const formData = new FormData(event.target);
       const combined = `${formData.get('text')}\n${await formData.get('file').text()}`; // Concatenate textarea and file inputs
-      const parsed = new Set(combined.split('\n').map(c => c.split(',')).flat().map(e => e.trim())); // Split on newline or comma, flatten, trim whitespace, de-duplicate
+      const parsed = new Set(combined.split('\n').map(c => c.split(',')).flat().map(e => e.trim().toLocaleLowerCase())); // Split on newline or comma, flatten, trim whitespace, lowercase, and de-duplicate
       const cleaned = [...parsed].filter(name => name.slice(-4) === '.eth'); // Remove anything that does not end in '.eth'
 
       if (cleaned.length === 0) {
This page took 0.043058 seconds and 4 git commands to generate.