feat: Add base64 string encoder/decoder to vega-expression and vega-interpreter#4009
Conversation
Deploying vega with
|
| Latest commit: |
d51ef3a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://792cf377.vega-628.pages.dev |
| Branch Preview URL: | https://cameron-yick-feature-add-bas.vega-628.pages.dev |
0437640 to
fd926b9
Compare
57ad81c to
4831149
Compare
vega-expression and vega-interpreter
4831149 to
05bf76e
Compare
05bf76e to
f56cf1f
Compare
| trim: x => String(x).trim(), | ||
| // Base64 encode/decode | ||
| // Convert binary string to base64-encoded ascii | ||
| btoa: x => btoa(x), |
There was a problem hiding this comment.
Could this just be
| btoa: x => btoa(x), | |
| btoa: btoa, |
There was a problem hiding this comment.
It could. A small difference is wrapping btoa in a function ensures that our public API ensures that only 1 argument is ever passed to btoa.
This is similar to how writing ['1','2'].map(parseInt) and ['1','2'].map((num) => parseInt(num)) are not equivalent
['5','2'].map((num) => parseInt(num))
// returns [5, 2]
['5','2'].map(parseInt)
// returns [5, NaN]The NaN appears as a result of calling parseInt(2, 1) since the index of the array is passed as the second arg of the mapping function, and changes the radix to something other than base 10. We want to avoid that.
93f4e75 to
cb92386
Compare
…r vega-interpreter
cb92386 to
d51ef3a
Compare
|
@domoritz I have added both a unit test for It felt a bit heavy to add 2 big JSONs just to test these two functions, but that appears to be the pattern for |
|
I had a similar reaction when I saw the tests but it's fine. |
Changes since v5.31.0 **vega-expression** * Add base64 string encoder/decoder to `vega-expression` and `vega-interpreter` (via #4009). (Thanks @hydrosquall!) **vega-typings** * Add Typescript Types for `vega-loader` (via #4000). (Thanks @hydrosquall!) **docs** * Correct data year citation in dorling-cartogram example (via #4006). (Thanks @dsmedia!) * Update typo in vega.timeFloor description (via #4010). (Thanks @hydrosquall!) * Add Security Advisory Policy for Vega (via #4008). (Thanks @hydrosquall!) * Replace redirect url in `expressions.md` (via #3996). (Thanks @dangotbanned!) * correct queries to query in `crossfilter.md` (via #4005). (Thanks @danmarshall!) --------- Signed-off-by: Lukas Hermann <1734032+lsh@users.noreply.github.com>
…ecode (atob, btoa) (#4023) ## Motivation - When #4009 was released, we didn't know the version number it would be used. Now we do! ## Changes - Replace 5.3x placeholder with 5.32.0, which is the correct version where https://github.com/vega/vega/releases/tag/v5.32.0 was made available
Motivation
Testing
expressionInterpretermode enabled editor#1460Notes
Buffer.from(instead.vega-functions(andvega-interpreter) #3973VEGA_DEBUG.viewto get a sample scenegraph.