Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timesplinter/pimple-js
A simple DIC written in TypeScript based on PHP's Pimple
https://github.com/timesplinter/pimple-js
Last synced: 29 days ago
JSON representation
A simple DIC written in TypeScript based on PHP's Pimple
- Host: GitHub
- URL: https://github.com/timesplinter/pimple-js
- Owner: TiMESPLiNTER
- Created: 2021-06-08T12:02:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-01T17:59:44.000Z (12 months ago)
- Last Synced: 2024-02-02T08:39:41.892Z (12 months ago)
- Language: TypeScript
- Size: 411 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pimple-js
Based on the work of
* M.PARAISO
* SerafimArtsand the original PHP Pimple container by Fabien Potencier.
## Usage
```ts
import Pimple from '@timesplinter/pimple';type ServiceMap = {
'foo': string,
'bar': string,
};const container: Container = new Pimple({env: 'dev'});
container.set('foo', () => {
return `baz (${container.get('env')})`;
});container.set('bar', (container: Pimple) => {
return `bar: ${container.get('foo')}`;
});console.log(container.get('foo')); // 'bar (dev)';
```## Transpiling
```bash
$ npm run transpile
```## Tests
```bash
$ npm run test # runs tests
$ npm run coverage # runs coverage
```