Skip to content

Destructured Function Parameter Injection #14

@basejump

Description

@basejump

Would be great to support unpacking or destructured objects for function parameters.
Working on a PR here with update to the readme.

// destructured object parameter wont require any annotations. 
function createEngine({power}) { ... }

//then in module config can take the simple route as well since function params are parsed and $inject is automatically added
const carModule = {
  engine: ['factory', createEngine ],
  power:  ['value', { horses: 400 }]
};

Let me know what you think. Would this be something your interested in merging in. Plan on finishing tests today and will convert PR off draft once done.
Great project, thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions