Skip to content

Latest commit

Β 

History

History

typed-use-cases

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Β 
Β 

πŸ‘ Typed Use Cases

Functional IoC using JS function context

#functional #solid

Following-up on function-resolve and mvc-functional-oop, I've embraced the this keyword and JavaScript's built in context management to achieve typed functional dependency injection with less boilerplate and dependencies

V1 Utils

Open in StackBlitz

const helloWorld = usecase(
  { greet, hello },
  function () {
    this.hello('World')
    this.greet('Earth')
  }
)

V2 Classes

Open in StackBlitz

class CalculateWithMultiply extends DependencyClass({
  ...Calculate.dependencies,
  ...Multiply.dependencies,
  run: async () => (await import('./multiply')).multiply,
}) {}