Class: DependencyCollection

DependencyCollection

Results container for results of querying injector dependencies.

'use strict'

var Injector = require('./injector')
var DependencyCollection = require('./DependencyCollection')

var injector = new Injector()
var a = { name: 'a', plugin: 'MyPlugin', type: 'factory', factory: () => 'a' }
var b = { name: 'b', plugin: 'MyPlugin', type: 'factory', factory: () => 'b' }
var c = { name: 'c', plugin: 'MyPlugin', type: 'other', factory: () => 'c' }

injector.register(a)
injector.register(b)
injector.register(c)

var dc = new DependencyCollection({a,b,c})
dc.filter({ type: 'factory' }).values()

Constructor

new DependencyCollection(collection)

Parameters:
Name Type Description
collection Array.<Dependency>

Base collection

Source:

Extends

Methods

filter(predicate) → {Array}

Filter the current collection and return a new collection (of the same type) containing items matching the predicate.

Parameters:
Name Type Description
predicate Object | function

Lodash-style predicate

Inherited From:
Source:
Returns:
Type
Array

values() → {Array}

Iterate through current contents of the collection and return the relative instances from the injector.

Source:
Returns:
Type
Array