New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

typescript-container

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-container

Laravel (illuminate/container) inspired/based IoC container.

  • 0.0.0-alpha.2
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Typescript Container (IOC)

Laravel (illuminate/container) inspired/based IoC container.

NPM Version

Downloads Stats

Nub Inversion of Control container highly based on illuminate/container from Laravel. You can think of it as a port of illuminate/container to typescript, however, there's no guarantee that everything would work as it should. This module was designed for typescript and thus I cannot guarantee compatibility with ES6 alone.

Installation

npm i --save typescript-container

Known issues

  • Contextual Bindings doesn't work just yet.
  • Every other stuffs aside from basic functionality.

Basic Usage

You can start by requiring the ioc container then do your thing.

const Container = require('typescript-container')
const WithDependencies = require('./src/WithDependencies')
const Dependency = require('./src/Dependency')

const app = Container.getInstance()

app.alias(Dependency, 'dependency')

const withDependencies = app.make(WithDependencies)

withDependencies.doStuff()

/********************************************/
// ./src/WithDependencies
const { Inject } = app

class WithDependencies {
  dep;

  constructor(@Inject('dependency') dep) {
    this.dep = dep
  }

  doStuff() {
    return this.dep.doSomething()
  }
}

/********************************************/
// ./src/Dependency
class Dependency {
  doSomething() {
    return 'hello'
  }
}


injecting dependencies to any other method also works.

Release History

  • 0.0.0-alpha.2
    • basic contextual binding added
  • 0.0.0-alpha.1
    • basic functionality

Meta

Jacob Baring – @yakovmeisterso@tfwno.gf

Distributed under the MIT license. See LICENSE for more information.

https://github.com/yakovmeister/

Contributing

  1. Fork it (https://github.com/yakovmeister/typescript-container/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Keywords

FAQs

Package last updated on 22 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc