diddly
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

diddly

Pure functional dependency injection for TypeScript

NOTE: This library is very experimental.

Benefits

  • 100% type safe
  • Purely functional
  • Immutable
  • Circular dependencies are impossible

Example

import { createContainer } from 'diddly';

function printNameAndAge(name: string, age: number) {
  console.log(`${name} is aged ${age}`);
}const container = createContainer()
  .register('someAge', value(5))
  .register('someName', value('Timmy'))
  .register('fn', func(printNameAndAge, 'someName', 'someAge'));const print = container.resolve('fn');
print(); // Prints "Timmy is aged 5"

Dependencies (0)

    Dev Dependencies (10)

    Package Sidebar

    Install

    npm i diddly

    Weekly Downloads

    1

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    28.6 kB

    Total Files

    14

    Last publish

    Collaborators

    • tom.sherman