Last active
July 7, 2017 00:18
-
-
Save elzii/454600cd14c2cbbf8e1c96a8ef86d238 to your computer and use it in GitHub Desktop.
Console script to convert SitePoint table of mimetypes to JSON string - https://www.sitepoint.com/mime-types-complete-list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var data = [] | |
| document.querySelectorAll('tbody tr').forEach(el => { | |
| var td = el.querySelectorAll('td') | |
| data.push({ | |
| 'suffix': td[0].innerHTML.replace(/\./, ''), | |
| 'contentType': td[1].innerHTML | |
| }) | |
| }) | |
| var json = JSON.stringify({ | |
| 'mimeTypes': data | |
| }, null, 2) | |
| document.write(`<pre>${json}</pre>`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment