Skip to content

Support unnamed desctructured parameters #32

@pvorona

Description

@pvorona

Currently I'm investigating the ability of implementing the following:

match({ a: 1, b: 2 })(
  ({ a = 3, b = 4 }) => 'doesnt match',
  ({ a = 1, ...c }) => 'matches with c = { b: 2 }',
  ({ a, b }, { c, d }) => 'doesnt match',
)

Compare to previous version:

match({ a: 1, b: 2 })(
  (x = { a = 3, b = 4 }) => 'doesnt match',
  (x = { a = 1, ...c }) => 'matches with c = { c: 2 }',
  (x = { a, b }, y = { c, d }) => 'doesnt match',
)

So the unneeded parameter x is removed. I can't find any closed issue addressed this idea. What's your thoughts on this thing?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions