Last active
April 26, 2024 20:02
-
-
Save fitzgen/35d7e3905a915238aa14 to your computer and use it in GitHub Desktop.
This file contains 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
# Proposed Format | |
{ | |
... | |
7. sources: ["baz.ts", "foo.js", "bar.js"] | |
... | |
9. mediaTypes: ["application/javascript", "application/x.typescript"], | |
10. sourcesMediaTypes: "CAA", | |
} | |
Line 9: A list containing the set of each media type M such that there is a | |
source whose associated media media type is M in the "sources" property. Media | |
types must conform to https://www.rfc-editor.org/rfc/rfc6838.txt. | |
Line 10: A string containing a list of base 64 VLQ encoded integers greater than | |
or equal to 0 with no separators. The number of integers encoded must not exceed | |
the length of the "sources" property. | |
To find a source S's associated media type: | |
1. Let sourceIndex be the index of S in the "sources" property. | |
2. Let sourcesMediaTypesLength be the number of integers encoded in the | |
"sourcesMediaTypes" property. | |
3. If sourceIndex >= sourcesMediaTypesLength, let mediaTypeIndex be 0. | |
4. Else, let mediaTypeIndex be the integer at sourceIndex in the base 64 VLQ | |
encoded "sourcesMediaTypes" property. | |
5. If mediaTypeIndex >= the length of the "mediaTypes" property, the return | |
value is undefined. | |
5. Return the media type at mediaTypeIndex in the "mediaTypes" property. | |
Note that in the above algorithm, lists of size N are indexed from 0 to N-1. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should explicitly state that these fields are optional and the second is invalid if the first is not present and that the absence doesn't imply anything.