Implement std.objectValues and std.objectValuesAll#858
Implement std.objectValues and std.objectValuesAll#858sbarzowski merged 1 commit intogoogle:masterfrom
Conversation
doc/ref/stdlib.html
Outdated
| If an external variable with the given name was defined, return its string value. Otherwise, raise an error. | ||
| </p> | ||
|
|
There was a problem hiding this comment.
Sorry about this noise - I have an vim trigger thing that deletes trailing whitespace ...
There was a problem hiding this comment.
Please don't edit this file manually. Here are the instructions for updating stdlib docs: https://github.com/google/jsonnet#locally-serving-the-website.
There was a problem hiding this comment.
Ah, that makes a lot more sense - updated.
sbarzowski
left a comment
There was a problem hiding this comment.
Thanks! This is a good addition to the standard library.
doc/ref/stdlib.html
Outdated
| If an external variable with the given name was defined, return its string value. Otherwise, raise an error. | ||
| </p> | ||
|
|
There was a problem hiding this comment.
Please don't edit this file manually. Here are the instructions for updating stdlib docs: https://github.com/google/jsonnet#locally-serving-the-website.
4aa1719 to
7956072
Compare
| assert std.isNumber(from) : 'substr second parameter should be a string, got ' + std.type(from); | ||
| assert std.isNumber(len) : 'substr third parameter should be a string, got ' + std.type(len); | ||
| assert len >=0 : 'substr third parameter should be greater than zero, got ' + len; | ||
| assert len >= 0 : 'substr third parameter should be greater than zero, got ' + len; |
There was a problem hiding this comment.
These changes are also all autoformatting but they look like good changes? I can rebase and just take the actual stuff I added if you want.
There was a problem hiding this comment.
Yeah, it looks like our own auto-formatting. Ideally that would be a separate commit, but that's not a big deal.
Hello friends!
This PR adds two helper functions for extracting an array of values from an object. This was not impossible before (hence the implementations are in jsonnet), but I think it is worth having a 'first class' implementation - for further evidence, it is a very common feature of data transformation libraries.
It was mentioned in this comment.