1.2 KiB
1.2 KiB
URI Value types
| type | info | format | example |
|---|---|---|---|
| vector | x,y,z | comma-separated | #pos=1,2,3 |
| string | color | FFFFFF (hex) | #fog=5m,FFAACC |
| string | #q=-sun | ||
| int | [-]x[xxxxx] | #price:>=100 | |
| float | [-]x[.xxxx] (ieee) | #prio=-20 | |
| array | mixed | |-separated | #pos=0,0,0 |
rule for thumb: type-limitations will piggyback JSON limitations (IEEE floatsize e.g.)
Url parser (the gist of it)
- fragment URI starts with
# - fragments are split by
& - fragment-values are urlencoded (
becomes+and so on) =is used to indicate fragmentvalues|is used to indicate multiple/fallback values- hex colors are detected using regex
/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ - integers are detected using regex
/^[0-9]+$/ - floats are detected using regex
/^[0-9]+\.[0-9]+$/ ,is used to detect vector 1D/2D/3D values like x[,y[,z]]- anything else will be treated as string-value
- last resort: inappropriate string values will be converted using parseInt/parseFloat