2.0.0 • Published 3 months ago

@timesplinter/pimple v2.0.0

Weekly downloads
-
License
LGPL-3.0-or-later
Repository
-
Last release
3 months ago

pimple-js

Based on the work of

and the original PHP Pimple container by Fabien Potencier.

Usage

import Pimple from '@timesplinter/pimple';

type ServiceMap = {
   'foo': string, 
   'bar': string,
};

const container: Container = new Pimple<ServiceMap>({env: 'dev'});

container.set('foo', () => {
    return `baz (${container.get('env')})`;
});

container.set('bar', (container: Pimple<ServiceMap>) => {
    return `bar: ${container.get('foo')}`;
});

console.log(container.get('foo')); // 'bar (dev)';

Transpiling

$ npm run transpile

Tests

$ npm run test     # runs tests
$ npm run coverage # runs coverage
2.0.0

3 months ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago