* Map a given file extension to the related data URL media type
(extension: string)
| 686 | * Map a given file extension to the related data URL media type |
| 687 | */ |
| 688 | function getMediaType(extension: string) { |
| 689 | if (extension === '.png') { |
| 690 | return 'image/png' |
| 691 | } |
| 692 | if (extension === '.jpg' || extension === '.jpeg') { |
| 693 | return 'image/jpg' |
| 694 | } |
| 695 | if (extension === '.gif') { |
| 696 | return 'image/gif' |
| 697 | } |
| 698 | if (extension === '.ico') { |
| 699 | return 'image/x-icon' |
| 700 | } |
| 701 | if (extension === '.webp') { |
| 702 | return 'image/webp' |
| 703 | } |
| 704 | if (extension === '.bmp') { |
| 705 | return 'image/bmp' |
| 706 | } |
| 707 | if (extension === '.avif') { |
| 708 | return 'image/avif' |
| 709 | } |
| 710 | if (extension === '.dds') { |
| 711 | return 'image/vnd-ms.dds' |
| 712 | } |
| 713 | |
| 714 | // fallback value as per the spec |
| 715 | return 'text/plain' |
| 716 | } |
| 717 | |
| 718 | /** |
| 719 | * `git diff` will write out messages about the line ending changes it knows |
no outgoing calls
no test coverage detected