# rwin

> Require When I Need is a Node.js module loader that loads the required module when you need it.

Latest version **1.1.8** (published 2013-12-22) · 0 weekly downloads

## Install

```sh
npm install rwin
pnpm add rwin
yarn add rwin
bun add rwin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.8 |
| Published | 2013-12-22 |
| First published | 2013-12-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.7 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lcf.vs |
| Maintainers | lcfvs |
| Keywords | require, modules, when, needed |

## Links

- npm: https://www.npmjs.com/package/rwin
- Repository: https://github.com/Lcfvs/rwin
- Homepage: https://github.com/Lcfvs/
- Issues: https://github.com/Lcfvs/rwin/issues
- npm.io page: https://npm.io/package/rwin

## Recent versions

- 1.1.8 (latest) — 2013-12-22
- 1.1.7 — 2013-12-22
- 1.1.6 — 2013-12-22
- 1.1.5 — 2013-12-22
- 1.1.4 — 2013-12-22
- 1.1.3 — 2013-12-22
- 1.1.2 — 2013-12-22
- 1.1.1 — 2013-12-22
- 1.1.0 — 2013-12-22
- 1.0.0 — 2013-12-22

## README

rwin
====

Like to keep your requires in the script header?

Tired to load modules that will possibly not been used and overloading your RAM?

<strong>Require When I Need</strong> is a lightweight tool that loads the required module only when and if you need it!

This Node.js module is under MIT License.


Install :
---------
`$ npm install rwin`


Usage :
-------
``` JavaScript
lib = rwin(imports, [dirname]);
```
Where :

`lib` : is an object that contains an accessor for each required modules

`imports` : is an object that contains the accessor name paired with the module path

`dirname` : is the source path, generally <strong>__dirname</strong> (useless if You only require installed modules)


Example:
--------
``` JavaScript
var rwin,
    imports,
    lib;

rwin = require('rwin');

imports = {
    installedModule: 'installed-module',
    uninstalledModule: '/uninstalled-module/path'
};

lib = rwin(imports, __dirname);

// At this point, rwin is the only one loaded module (and its own dependencies)

console.log(lib.installedModule); // loads the module & returns it to the console
```

---
_Source: https://npm.io/package/rwin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
