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

enhancement(stdlib): Add support for keys parameter to object_from_array #1176

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

bruceg
Copy link
Member

@bruceg bruceg commented Dec 5, 2024

Summary

Continuing #1164

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance
  • Enhancement

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on
    our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Our CONTRIBUTING.md is a good starting place.
  • If this PR introduces changes to LICENSE-3rdparty.csv, please
    run dd-rust-license-tool write and commit the changes. More details here.
  • For new VRL functions, please also create a sibling PR in Vector to document the new function.

References

#1157

@bruceg bruceg added type: enhancement A value-adding code change that enhances its existing functionality vrl: stdlib Changes to the standard library no-changelog Changes in this PR do not need user-facing explanations in the release changelog labels Dec 5, 2024
@bruceg bruceg requested a review from pront December 5, 2024 03:50
Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

Thanks, this is a nice utility function.

@@ -1,27 +1,39 @@
use super::util::ConstOrExpr;
use crate::compiler::prelude::*;

fn make_object(values: Vec<Value>) -> Resolved {
fn make_object1(values: Vec<Value>) -> Resolved {
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
fn make_object1(values: Vec<Value>) -> Resolved {
fn make_object_1(values: Vec<Value>) -> Resolved {

values
.into_iter()
.map(make_key_value)
.collect::<Result<_, _>>()
.map(Value::Object)
}

fn make_object2(keys: Vec<Value>, values: Vec<Value>) -> Resolved {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fn make_object2(keys: Vec<Value>, values: Vec<Value>) -> Resolved {
fn make_object_2(keys: Vec<Value>, values: Vec<Value>) -> Resolved {

@bruceg bruceg enabled auto-merge December 5, 2024 16:25
@bruceg bruceg added this pull request to the merge queue Dec 5, 2024
Merged via the queue into main with commit 4bad088 Dec 5, 2024
14 checks passed
@bruceg bruceg deleted the bruceg/object-from-array2 branch December 5, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Changes in this PR do not need user-facing explanations in the release changelog type: enhancement A value-adding code change that enhances its existing functionality vrl: stdlib Changes to the standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants