npm: possibly marvellous

    inject3
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.1 • Public • Published

    inject3

    Inject a dependency (service locator pattern).

    Install

    npm install --save-dev inject3

    Usage

    // app.ts
    import { inject } from 'inject3';
    const fs = inject('fs', () => require('fs'));
    fs.readFileSync('data.json');
    
    // app.spec.ts
    import { injector } from 'inject3';
    injector.mock('fs', () => ({
      readFileSync: () => 'result of call of fs.readFileSync()',
    }));

    Install

    npm i inject3

    DownloadsWeekly Downloads

    15

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    9.6 kB

    Total Files

    10

    Last publish

    Collaborators

    • iamthes