open-index/open-npm huggingface dataset:
npm package: @langovoi/inject-loader
Description: A Webpack loader for injecting code into modules via their dependencies
Author: Justin Morris
Latest version: 5.0.4

<div align="center">
  <h3>💉📦<br><br><code>inject-loader</code></h3>
  <h4>A Webpack loader for injecting code into modules via their dependencies</h4>
  <a href="https://travis-ci.org/plasticine/inject-loader"><img src="https://img.shields.io/travis/plasticine/inject-loader/master.svg?style=flat-square" alt="build status" /></a> <a href="https://www.npmjs.com/package/inject-loader"><img src="https://img.shields.io/npm/v/inject-loader.svg?style=flat-square" alt="npm version" /></a> <a href="https://www.npmjs.com/package/inject-loader"><img src="https://img.shields.io/npm/dm/inject-loader.svg?style=flat-square" alt="npm downloads" /></a>
</div>

***

### Why

This is particularly useful for writing tests where mocking things inside your module-under-test is sometimes necessary before execution.

`inject-loader` was inspired by, and builds upon ideas introduced in [jauco/webpack-injectable](https://github.com/jauco/webpack-injectable).

### Usage

[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)

Use the inject loader by adding the `inject-loader!` [inline loader](https://webpack.js.org/concepts/loaders/#inline) when you use `require`, this will return a function that can used in test code to modify the injected module.

By default all `require` statements in an injected module will be altered to be replaced with an injector, though if a replacement it not specified the default values will be used.

### Examples

Given some code in a module like this:

```javascript
// MyStore.js

var Dispatcher = require('lib/dispatcher');
var EventEmitter = require('events').EventEmitter;
var handleAction = require('lib/handle_action');

Dispatcher.register(handleAction, 'MyStore');
```

You can manipulate it’s dependencies when you come to write tests as follows:

```javascript
// If no flags are provided when using the loader then
// all require statements will be wrapped in an injector
MyModuleInjector = require('inject-loader!MyStore')
MyModule = MyModuleInjector({
  'lib/dispatcher': DispatcherMock,
  'events': EventsMock,
  'lib/handle_action': HandleActionMock
})
```

There are a few examples of complete test setups for both Webpack 1, 2, 3 & 4 in the [`example`](./example) folder.

## License

MIT (http://www.opensource.org/licenses/mit-license.php)
npm package: @langovoi/upnp-device-client
Description: A simple and versatile UPnP device client
Author: thibauts
Latest version: 1.0.6

upnp-device-client
==================
### A simple and versatile UPnP device client

This module can query UPnP devices descriptions, service descriptions and call actions on services. It also provides a simple interface to subscribe to UPnP services events.

Install
-------

```bash
$ npm install @langovoi/upnp-device-client
```

Usage
-----

```javascript
var Client = require('@langovoi/upnp-device-client');

// Instanciate a client with a device description URL (discovered by SSDP)
var client = new Client('http://192.168.1.50:4873/foo.xml');

// Get the device description
client.getDeviceDescription(function(err, description) {
  if(err) throw err;
  console.log(description);
});

// Get the device's AVTransport service description
client.getServiceDescription('AVTransport', function(err, description) {
  if(err) throw err;
  console.log(description);
});

// Call GetMediaInfo on the AVTransport service
client.callAction('AVTransport', 'GetMediaInfo', { InstanceID: 0 }, function(err, result) {
  if(err) throw err;
  console.log(result); // => { NrTracks: '1', MediaDuration: ... }
});

client.subscribe('AVTransport', function(e) {
  // Will receive events like { InstanceID: 0, TransportState: 'PLAYING' } when playing media
  console.log(e); 
});

// client.unsubscribe('AVTransport', listener);
```

Run with debug traces

```bash
$ DEBUG=* node index.js
```

or you can pass your own logger

```javascript
var client = new Client('http://192.168.1.50:4873/foo.xml', {
    customLogger: console.log
})
```