koa-container
Dependency injection container with twist of koa-compose
Extends Jimple
Usage
var Container = ; var c = ; c;c; c; // Will log// > A// > C// > D// > B// > done
Differences with Jimple API
container.matchKeys(pattern, values)
Use path-to-regexp to match keys.
Arguments
- pattern: A key pattern
- values: If true, results will also have a
value
key set tocontainer.get(key)
cnt;
Returns an Array
of objects with keys:
- key: key that matched
- params: key parameters as matched by pattern
- value(optional): If
values
is true the result ofcontainer.get(key)
container.setdefault(key, value)
Similar to Python's dict.setdefault(key, value)
method.
It gets the value of a key or sets it to value if not defined.