Skip to content

Support $omitKeys for arrays of objects #60

@benny779

Description

@benny779

Currently, $omitKeys(object, keys[]) works only when the input is a single object. However, in many real-world use cases, data is often represented as an array of objects, requiring users to manually map over the array to apply $omitKeys to each item.

Problem

Given an input like:

[
  { "a": 1, "b": 2 },
  { "a": 3, "b": 4 }
]

Users currently need to write::

$map(data, function($v) { $omitKeys($v, ["b"]) })

or

data.$omitKeys($, ["b"])

Proposed Enhancement

Allow $omitKeys to accept an array of objects as input and apply the omission to each element automatically.

Example:

$omitKeys(data, ["b"])

####Expected Output:

[
  { "a": 1 },
  { "a": 3 }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions