Skip to content
Sign up
Appearance settings

Add objectValues and objectValuesAll to stdlib#104

Merged
lihaoyi-databricks merged 1 commit intodatabricks:masterfrom
dvgica:add-objectValues
Dec 16, 2020
Merged

Add objectValues and objectValuesAll to stdlib#104
lihaoyi-databricks merged 1 commit intodatabricks:masterfrom
dvgica:add-objectValues

Conversation

@dvgica
Copy link
Copy Markdown
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
Copy Markdown
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