2.0.0 • Published 1 year ago

@timesplinter/pimple v2.0.0

Weekly downloads
-
License
LGPL-3.0-or-later
Repository
-
Last release
1 year 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

1 year ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago