Skip to content

Accessing context values using dot notation #76

@realChakrawarti

Description

@realChakrawarti

Clear and concise description of the problem

As you can see in the screenshot below of the code snippets, source, when a multi-word is used as an option, the only way to get the values from the context is using [] square notation.

Image

Suggested solution

Though we could do something like this, const listArchive = ctx.values["list-archived"] which is type-safe and also autocompletes on tabs.

But it would be nice to have a flag within define({enableCamelCasing: true}) which could convert kebab-case into camelCase automatically for easier access and even could be de-structured right from context.values like,

// Instead of
const listArchived = ctx.values["list-archived"];
// OR
const {"list-archived": listArchived} = ctx.values;


// This 🔽
const {listArchived} = ctx.values;

Alternative

Also, it would be nice to support dotted options down the line.

Additional context

No response

Validations

  • Read the Contributing Guide.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIncludes new features🍰 p2-nice-to-havePriority 2: nothing is broken but it's worth addressing

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions