Can we separate our dependencies from our data?

What if we could distinguish between our dependencies which are injected and the arguments needed for the function?

What if we could do this on a per function basis?

I'd like to propose a new syntax for JS

function myFunction{dependancy1, dependancy2}(argument1, argument2) {
    const myLocal =, myLocal)

Or in arrow notation:

const myFunction{dependancy1, dependancy2} = (argument1, argument2) => {
    const myLocal =, myLocal)

The main benefit here is to make it explicit what is a dependency which is unlikely to change from function call to function call, and what is an argument, which we expect to be different every time the function is called.

There are a few options on how this can be used.

  1. If you don't pass in any dependency, then the value of the last dependency that was passed in is used, or a reference which was declared elsewhere is used. (e.x. myFunction(arg1, arg2) ).

  2. If you do pass in a dependancy, it is used. ( e.g. myFuntion{fakeDependency, mockDependency}(arg1 , arg2) )

Could also be useful for callbacks

function asyncThing{dependancy, callback}(arg1, arg2) {
   dependancy.foobar(arg1, arg2)