1.1.1 • Published 2 years ago

inject3 v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

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()',
}));