Skip to content

Add utils method to access values with string dot notation #197

@alexanderkirtzel

Description

@alexanderkirtzel

Is your feature request related to a problem? Please describe.
Destination configurations define values in a string dot notation like data.title. This can be unified to standardize access and minimize file size.

Describe the solution you'd like
Require a key as a string, and an object to read from.
Support wildcards, by adding an i parameter (like nested.*.data.title and 2 as the index)

Additional context
One function being used with wildcard:

// String dot notation for object ("data.id" -> { data: { id: 1 } })
const value = key.split('.').reduce((obj, key) => {
  // Update the wildcard to the current nested index
  if (key == '*') key = String(i);

  return obj[key] || defaultValue;
}, event);

Metadata

Metadata

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