Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add objectValues and objectValuesAll to stdlib #104

Merged
merged 1 commit into from
Dec 16, 2020

Conversation

dvgica
Copy link
Contributor

@dvgica dvgica commented Nov 25, 2020

This fixes #103. I believe my implementation takes the same approach (in Scala) as the jsonnet implementation in google/jsonnet#858.

Tested by running mill __.test.test, everything passes.


def getObjValuesFromKeys(ev: EvalScope, fs: FileScope, v1: Val.Obj, keys: Seq[String]): Val.Arr = {
Val.Arr(keys.map { k =>
Val.Lazy(v1.value(k, -1)(fs, ev))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit unsure about the offset argument here, but saw -1 used elsewhere. Let me know if it should be different.

@lihaoyi-databricks lihaoyi-databricks merged commit 71c654e into databricks:master Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for std.objectValues and std.objectValuesAll
2 participants